def addNewAppUser(): if (request.method == 'POST'): userid = request.form['email'] pwd = request.form['passwd'] conf_pwd = request.form['cnfpasswd'] if (pwd == conf_pwd): appusr = AppUserDB(userid, pwd) print(appusr.userid) else: return (redirect(url_for('index'), code=302)) created_usr = appusr.add_new_user(db) if created_usr is None: redirect_url = 'index' session_id = '' else: redirect_url = 'home' session_id = session.startUserSession(userid) response = redirect(url_for(redirect_url), code=302) response.set_cookie('session', value=session_id) return (response)
def addNewAppUser(): if(request.method == 'POST'): userid = request.form['email'] pwd = request.form['passwd'] conf_pwd = request.form['cnfpasswd'] if(pwd == conf_pwd): appusr = AppUserDB(userid, pwd) print(appusr.userid) else: return(redirect(url_for('index'), code=302)) created_usr = appusr.add_new_user(db) if created_usr is None: redirect_url = 'index' session_id = '' else: redirect_url = 'home' session_id = session.startUserSession(userid) response = redirect(url_for(redirect_url), code=302) response.set_cookie('session', value=session_id) return(response)
def userAppLogin(): # We should not ideally check for the method, since only allowed method is 'POST'.But still to be # safe and to maintain sanity in flask coding convention, we will do it :) if (request.method == 'POST'): userid = request.form['email'] pwd = request.form['passwd'] appuser = AppUserDB(userid, pwd) can_login = appuser.validate_user(userid, pwd, db) if can_login: redirect_url = 'home' session_id = session.startUserSession(userid) else: redirect_url = 'index' session_id = '' response = redirect(url_for(redirect_url), code=302) response.set_cookie('session', session_id) return (response)
def userAppLogin(): # We should not ideally check for the method, since only allowed method is 'POST'.But still to be # safe and to maintain sanity in flask coding convention, we will do it :) if(request.method == 'POST'): userid = request.form['email'] pwd = request.form['passwd'] appuser = AppUserDB(userid, pwd) can_login = appuser.validate_user(userid, pwd, db) if can_login: redirect_url = 'home' session_id = session.startUserSession(userid) else: redirect_url = 'index' session_id = '' response = redirect(url_for(redirect_url), code=302) response.set_cookie('session', session_id) return(response)