diff --git a/location_app/app/functions/auth/change_password.py b/location_app/app/functions/auth/change_password.py index 900ce4d..0859cc3 100644 --- a/location_app/app/functions/auth/change_password.py +++ b/location_app/app/functions/auth/change_password.py @@ -7,7 +7,9 @@ database_user = "app/databases/users.db" def change_password(data): """ - Function to allow password change + Takes in data for password change and checks if + data matches the one in the database, then + returns 'success' or an error message """ base.create() _status = check_pass_data(data) @@ -18,7 +20,8 @@ def change_password(data): def check_pass_data(data): """ - Function to check password data is valid + Compares dates of birth and if the new passwords match, + then returns 'success' or an error message """ _status = check_empty(data) if _status == "ok": @@ -37,7 +40,8 @@ def check_pass_data(data): def check_empty(data): """ - Function to if the fields are empty + Checks if all the fields in the dictionary are filled, + if not tells which one is missing """ if data['username'] == "": return "empty_id" @@ -58,7 +62,7 @@ def check_empty(data): def update_password(data): """ - Function to update new password in the database + Updates the password for the user """ con = sql.connect(database_user) cur = con.cursor() diff --git a/location_app/app/functions/auth/create_profile.py b/location_app/app/functions/auth/create_profile.py index 54d63f5..08a0a6a 100644 --- a/location_app/app/functions/auth/create_profile.py +++ b/location_app/app/functions/auth/create_profile.py @@ -7,7 +7,10 @@ database_user = "app/databases/users.db" def create_profile(data): """ - Function to create new profile + Takes in data for account creation and checks if + the account can be made and then calls a function + to create the account + Returns 'success' or an error message on failure """ base.create() _status = check_prof_data(data) @@ -18,7 +21,9 @@ def create_profile(data): def check_prof_data(data): """ - Function to the validity of profile data + Checks if the id exists if it's in use, if the + passwords match and if the date is valid + and returns 'success' or an error message """ _status = check_empty(data) if _status == "ok": @@ -41,7 +46,8 @@ def check_prof_data(data): def check_empty(data): """ - Function to check if the fields are filled + Checks if all the fields in the dictionary are filled, + if not tells which one is missing """ if data['username'] == "": return "empty_id" @@ -66,7 +72,7 @@ def check_empty(data): def make_user(data): """ - Function to add new user to the database + Inserts new user data into the database """ con = sql.connect(database_user) cur = con.cursor() diff --git a/location_app/app/functions/auth/login.py b/location_app/app/functions/auth/login.py index 933b71f..8099dd6 100644 --- a/location_app/app/functions/auth/login.py +++ b/location_app/app/functions/auth/login.py @@ -4,17 +4,19 @@ from app.functions.auth import base def login(data): """ - Function to start to start the login + Takes in data for login and checks if the data + matches with the one in the database and returns + 'success' or an error message """ base.create() - l_status = check_login_data(data) - return l_status + _status = check_login_data(data) + return _status def check_login_data(data): """ - Function to check the login data + Checks the validity of inputed data """ _status = check_empty(data) if _status == "ok": @@ -33,7 +35,8 @@ def check_login_data(data): def check_empty(data): """ - Function to check whether the fields are filled + Checks if all the fields in the dictionary are filled, + if not tells which one is missing """ if data['username'] == "": return "empty_id"