Skip to content
Permalink
Browse files
fixing docs
  • Loading branch information
memica committed Mar 14, 2020
1 parent dc82675 commit 491cf944a337aa9458389c4e14b8adccb6cf3f1b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 13 deletions.
@@ -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()
@@ -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()
@@ -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"

0 comments on commit 491cf94

Please sign in to comment.