def newpw(): message = '<div class="redalert"><center>' if request.method == "GET": return redirect(url_for("login")) else: u = request.form['user'].strip() op = request.form['oldpass'].strip() np1 = request.form['newpass1'].strip() np2 = request.form['newpass2'].strip() if np1 != np2: flash('New Passwords do not match, Please Try Again') return redirect( url_for("pwreset", usr = u) ) elif len(np1) < 6: flash('Passwords must have at least 6 characters, Please Try Again') return redirect( url_for("pwreset", usr = u) ) elif user.authenticate( u, op ): user.web_pw_reset( u, np1 ) return redirect( url_for("logout") ) else: flash('Incorrect Password, Please Try Again') return redirect( url_for("pwreset", usr = u) )
def newpw(): message = '<div class="redalert"><center>' if request.method == "GET": return redirect(url_for("login")) else: u = request.form['user'].strip() op = request.form['oldpass'].strip() np1 = request.form['newpass1'].strip() np2 = request.form['newpass2'].strip() if np1 != np2: flash('New Passwords do not match, Please Try Again') return redirect(url_for("pwreset", usr=u)) elif len(np1) < 6: flash( 'Passwords must have at least 6 characters, Please Try Again') return redirect(url_for("pwreset", usr=u)) elif user.authenticate(u, op): user.web_pw_reset(u, np1) return redirect(url_for("logout")) else: flash('Incorrect Password, Please Try Again') return redirect(url_for("pwreset", usr=u))
def login(): if request.method == "GET": return render_template("login.html") else: if 'user' in request.form: u = request.form['user'].strip() p = request.form['pass'].strip() else: u = 'anon' if u not in user.getUserList(): #userdic.keys(): print u print 'no esta aqui' return redirect(url_for('login')) elif user.authenticate( u, p ): session['user'] = u session['teacher'] = user.getDBUser(u) #userdic[u] print session return redirect( url_for('selectclass')) else: return redirect(url_for('login'))
def login(): if request.method == "GET": return render_template("login.html") else: if 'user' in request.form: u = request.form['user'].strip() p = request.form['pass'].strip() else: u = 'anon' if u not in user.getUserList(): #userdic.keys(): print u print 'no esta aqui' return redirect(url_for('login')) elif user.authenticate(u, p): session['user'] = u session['teacher'] = user.getDBUser(u) #userdic[u] print session return redirect(url_for('selectclass')) else: return redirect(url_for('login'))