def POST(self): post_params = web.input() username = post_params['userID'] password = post_params['password'] confirmPassword = post_params['confirmPassword'] if username == "": return render_template('create_account.html', message="Please enter a non-empty username") if password == "": return render_template('create_account.html', message="Please enter a non-empty password") if password != confirmPassword: return render_template( 'create_account.html', message="Password does not match Confirm Password!") usernameExistCheck = sqlitedb.getPassword(username) if len(usernameExistCheck) != 0: message = "Username '" message = message + username message = message + "' already exists. Please choose a different username!" return render_template('create_account.html', message=message) else: sqlitedb.addUser(username, password) sqlitedb.addAboutMe(username, "Currently no about me.") session.user = username return web.redirect('/hello')
def POST(self): post_params = web.input() userIDInput = post_params['userID'] passwordInput = post_params['password'] actualPasswordResult = sqlitedb.getPassword(userIDInput) if len(actualPasswordResult) == 0: return render_template('login.html', message = "Username " + userIDInput + " does not exist.") else: actualPassword = actualPasswordResult[0]['Password'] if passwordInput == actualPassword: session.user = userIDInput return web.redirect('/hello') else: return render_template('login.html', message = "Please enter the correct password.")
def POST(self): post_params = web.input() userIDInput = post_params['userID'] passwordInput = post_params['password'] actualPasswordResult = sqlitedb.getPassword(userIDInput) if len(actualPasswordResult) == 0: return render_template('login.html', message="Username " + userIDInput + " does not exist.") else: actualPassword = actualPasswordResult[0]['Password'] if passwordInput == actualPassword: session.user = userIDInput return web.redirect('/hello') else: return render_template( 'login.html', message="Please enter the correct password.")
def POST(self): post_params = web.input() username = post_params['userID'] password = post_params['password'] confirmPassword = post_params['confirmPassword'] if username == "": return render_template('create_account.html', message = "Please enter a non-empty username") if password == "": return render_template('create_account.html', message = "Please enter a non-empty password") if password != confirmPassword: return render_template('create_account.html', message = "Password does not match Confirm Password!") usernameExistCheck = sqlitedb.getPassword(username) if len(usernameExistCheck) != 0: message = "Username '" message = message + username message = message + "' already exists. Please choose a different username!" return render_template('create_account.html', message = message) else: sqlitedb.addUser(username, password) sqlitedb.addAboutMe(username, "Currently no about me.") session.user = username return web.redirect('/hello')