From 65da860d288464b7eb35c1be9fb81008dd00ed6b Mon Sep 17 00:00:00 2001 From: Adnan Memic Date: Thu, 5 Mar 2020 23:39:18 +0000 Subject: [PATCH] messages --- .../app/functions/auth/change_password.py | 10 ++- .../app/functions/auth/create_profile.py | 27 ++----- location_app/app/functions/auth/login.py | 4 +- location_app/app/static/css/login/create.css | 15 ++-- location_app/app/static/css/login/forgot.css | 5 ++ location_app/app/templates/login/create.html | 78 +++++++++++++------ location_app/app/templates/login/forgot.html | 58 +++++++++----- location_app/app/templates/login/index.html | 8 +- 8 files changed, 131 insertions(+), 74 deletions(-) diff --git a/location_app/app/functions/auth/change_password.py b/location_app/app/functions/auth/change_password.py index 7c62b87..5b7dd73 100644 --- a/location_app/app/functions/auth/change_password.py +++ b/location_app/app/functions/auth/change_password.py @@ -22,7 +22,7 @@ def check_pass_data(data): if not (data['password'] == data['r_password']): return "pass_no_match" return "success" - return "no_user" + return "no_id" else: return _status @@ -31,13 +31,15 @@ def check_empty(data): if data['username'] == "": return "empty_id" elif data['day'] == "0": - return "empty_day" + return "empty_bday" elif data['month'] == "0": - return "empty_month" + return "empty_bday" elif data['year'] == "0": - return "empty_year" + return "empty_bday" elif data['password'] == "": return "empty_pass" + elif data['password'] == "": + return "empty_rpass" else: return "ok" diff --git a/location_app/app/functions/auth/create_profile.py b/location_app/app/functions/auth/create_profile.py index 15b95c9..904518d 100644 --- a/location_app/app/functions/auth/create_profile.py +++ b/location_app/app/functions/auth/create_profile.py @@ -13,6 +13,7 @@ def create_profile(data): return _status def check_prof_data(data): + print(data) _status = check_empty(data) if _status == "ok": if base.tid_exists(data['username']): @@ -20,7 +21,7 @@ def check_prof_data(data): if not (data['password'] == data['r_password']): return "pass_no_match" elif not base.check_date(data['day'], data['month'], data['year']): - return "bad_date" + return "wrong_date" else: return "success" else: @@ -35,11 +36,11 @@ def check_empty(data): elif data['realname'] == "": return "empty_name" elif data['day'] == "0": - return "empty_day" + return "empty_bday" elif data['month'] == "0": - return "empty_month" + return "empty_bday" elif data['year'] == "0": - return "empty_year" + return "empty_bday" elif data['gender'] == "": return "empty_gender" elif data['height'] == "": @@ -48,6 +49,8 @@ def check_empty(data): return "empty_weight" elif data['password'] == "": return "empty_pass" + elif data['password'] == "": + return "empty_rpass" else: return "ok" @@ -60,18 +63,4 @@ def make_user(data): cur.execute(com) con.commit() cur.close() - con.close() - - -# ImmutableMultiDict([ -# ('username', '69'), -# ('realname', 'Adi'), -# ('day', '23'), -# ('month', '1'), -# ('year', '1998'), -# ('gender', 'male'), -# ('height', '183'), -# ('weight', '75'), -# ('password', 'fisgib-duwxut-4Rowhi'), -# ('r_password', 'fisgib-duwxut-4Rowhi')]) - + con.close() \ No newline at end of file diff --git a/location_app/app/functions/auth/login.py b/location_app/app/functions/auth/login.py index ec5c6f5..708dbce 100644 --- a/location_app/app/functions/auth/login.py +++ b/location_app/app/functions/auth/login.py @@ -16,9 +16,9 @@ def check_login_data(data): if data['username'] == "admin": return "success" if not base.user_exists(data['username']): - return "no_user" + return "no_id" if not base.compare(data['username'], data['password'], "password"): - return "wrong_password" + return "wrong_pass" return "success" else: return _status diff --git a/location_app/app/static/css/login/create.css b/location_app/app/static/css/login/create.css index 710a70f..817590a 100644 --- a/location_app/app/static/css/login/create.css +++ b/location_app/app/static/css/login/create.css @@ -53,7 +53,7 @@ justify-content: start; align-content: center; grid-template-columns: 2fr 2fr; - grid-template-rows: 0.25fr 1.5fr 0.25fr 1.5fr 0.25fr 1.5fr 0.25fr 1.5fr 1.5fr 0.25fr 1.5fr 1.5fr 1.5fr; + grid-template-rows: 0.25fr 1.5fr 0.15fr 1.5fr 0.15fr 1.5fr 0.15fr 1.5fr 1.5fr 0.15fr 1.5fr 0.15fr 1.5fr 1.5fr 1.5fr; grid-template-areas: '. .' 'user user' @@ -63,7 +63,9 @@ 'dob dob' '. .' 'gender gender' - 'height weight' + 'height height' + '. .' + 'weight weight' '. .' 'pass pass' 'r_pass r_pass' @@ -177,11 +179,12 @@ font-size: 1.5vw; border-radius: 10em; } +.error_text { + color: red; + font-size: 1.5vw; + padding-top: 5px; +} input { width: 100%; font-size: 2vw; -} -input.short { - width: 80%; - font-size: 2vw; } \ No newline at end of file diff --git a/location_app/app/static/css/login/forgot.css b/location_app/app/static/css/login/forgot.css index dcaa9f3..64c4dbd 100644 --- a/location_app/app/static/css/login/forgot.css +++ b/location_app/app/static/css/login/forgot.css @@ -109,6 +109,11 @@ font-size: 2vw; border-radius: 10em; } +.error_text { + color: red; + font-size: 1.5vw; + padding-top: 5px; +} input { width: 100%; font-size: 2vw; diff --git a/location_app/app/templates/login/create.html b/location_app/app/templates/login/create.html index 8370111..78762e2 100644 --- a/location_app/app/templates/login/create.html +++ b/location_app/app/templates/login/create.html @@ -20,7 +20,7 @@

Trackmaster

-

Create Account - {{status}}

+

Create Account

@@ -28,57 +28,91 @@

ID:


+ {% if status == 'no_id' %} +

Wrong ID

+ {% elif status == 'empty_id' %} +

Empty ID

+ {% elif status == 'user_exists' %} +

User exists

+ {% endif %}

Name:


+ {% if status == 'empty_name' %} +

Empty Name

+ {% endif %}

Birthday:


- - - +
+ + + +
+ {% if status == 'wrong_date' %} +

Wrong Date

+ {% elif status == 'empty_bday' %} +

Empty Date

+ {% endif %}

Gender:


- +

Male

Female

+ {% if status == 'empty_gender' %} +

Empty Height

+ {% endif %}

Height (cm):


- + + {% if status == 'empty_height' %} +

Empty Height

+ {% endif %}

Weight (kg):


- + + {% if status == 'empty_weight' %} +

Empty Weight

+ {% endif %}

Password:


+ {% if status == 'empty_pass' %} +

Empty Password

+ {% endif %}
+ {% if status == 'empty_rpass' %} +

Empty Repeat Password

+ {% elif status == 'pass_no_match' %} +

Passwords don't match

+ {% endif %}
diff --git a/location_app/app/templates/login/forgot.html b/location_app/app/templates/login/forgot.html index 5884067..b66e52f 100644 --- a/location_app/app/templates/login/forgot.html +++ b/location_app/app/templates/login/forgot.html @@ -20,7 +20,7 @@

Trackmaster

-

Forgot Password - {{status}}

+

Forgot Password

@@ -28,34 +28,54 @@

ID:


+ {% if status == 'no_id' %} +

Wrong ID

+ {% elif status == 'empty_id' %} +

Empty ID

+ {% endif %}

Birthday:


- - - +
+ + + +
+ {% if status == 'wrong_date' %} +

Wrong Date

+ {% elif status == 'empty_bday' %} +

Empty Date

+ {% endif %}

New Password:


+ {% if status == 'empty_pass' %} +

Empty Password

+ {% endif %}
+ {% if status == 'empty_rpass' %} +

Empty Repeat Password

+ {% if status == 'pass_no_match' %} +

Passwords don't match

+ {% endif %}
diff --git a/location_app/app/templates/login/index.html b/location_app/app/templates/login/index.html index b54fe75..8ceb405 100644 --- a/location_app/app/templates/login/index.html +++ b/location_app/app/templates/login/index.html @@ -28,15 +28,19 @@

ID:


- {% if status == 'no_user' %} + {% if status == 'no_id' %}

Wrong ID

+ {% elif status == 'empty_id' %} +

Empty ID

{% endif %}

Password:


- {% if status == 'wrong_password' %} + {% if status == 'wrong_pass' %}

Wrong password

+ {% elif status == 'empty_pass' %} +

Empty password

{% endif %}