Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Authentication

Code Block
create user(email, username, password):

...



// Check email if email is valid

...



validate_email(email)

...



 

...



// check if username is invalid

...



If len(username) > 100 and len(username) < 5:

...



Input error

...



// check if password is invalid

...



If len(password) > 100 and len(password) < 5:

...



Input error

...



 

...



Hash password

...



 

...



// check for duplicate email

...



If other user has same email:

...



            Input error

...



 

...



Create new user

...



Add user to database

...



Return success = True

 

Code Block
create_session(username, password):

...



hash password

...



Find user in database

...



If user not found:

...



            Input error 

...



Create new session

...



Add session to database

...



Create token

...



Return token

Code Block
remove_session(token):


session = load_token(token)

...



Remove session from database

...



Return {}

 

Code Block
check_token(token):

...



            Session = load_token(token)

...



            Return session.userId

 

load_token(token):

try:

decode token

...

communication_report(error_codes, time_sent):

for error code in error codes:

include readable message

return

 

Email system

validate_email(email):

...

send_email(xml, timer_start): 

error_codes = []

contacts = customerContact(xml)

...