Advertisement
Guest User

Untitled

a guest
Jan 30th, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.32 KB | None | 0 0
  1. def userLogin():
  2.         attemptedUser = request.form['loginName']
  3.         attemptedPW = request.form['loginPW']
  4.         userCheck = models.User.query.filter_by(accountName=attemptedUser).first()
  5.  
  6.         if userCheck == None:
  7.             flash('Error Logging In', 'error')
  8.         else:
  9.             if attemptedPW == userCheck.password:
  10.                 if userCheck.accessLevel == 1:
  11.                     loggedInAdmin = Admin(userCheck.accountName)
  12.                     flash(userCheck.accountName + ' - You Have Logged In As An Admin', 'success')
  13.                     print loggedInAdmin
  14.                 elif userCheck.accessLevel == 2:
  15.                     loggedInPM = ProjectManager(userCheck.accountName)
  16.                     flash(userCheck.accountName + ' - You Have Logged In As A Project Manager', 'success')
  17.                     print loggedInPM
  18.                 elif userCheck.accessLevel == 3:
  19.                     loggedInPresenter = Presenter(userCheck.accountName)
  20.                     flash(userCheck.accountName + ' - You Have Logged In As A Presenter', 'success')
  21.                     print loggedInPresenter
  22.                 else:
  23.                     flash('Error Logging In', 'error')
  24.             else:
  25.                 flash('Error Logging In', 'error')
  26.                
  27.         return redirect(url_for('index'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement