def forgotpassword(): email = request.args.get('email') if email: return render_template('newpassword.html') else: return render_template('forgotpassword.html')
def admin(url=None): email, code = self.retAUTHCODE(request.cookies.get('loginsession')) if code == 1: try: return render_template('admin/%s' % url) except: return render_template('404.html') else: return redirect('/index')
def resettoken(): email = request.form.get('email') if email and self.checkuserexists(email): token, created = self.makepasswordresettoken(email) if created: send_mail(email, 'Food Truck: Password reset token', render_template('emails/password_reset_mail.html', email=email, token=quote(token))) return redirect('/forgotpassword?success=A-reset-token-has-been-sent-to-your-email') else: return '<h1>Internal Server Error</h1>' else: return redirect('/forgotpassword?tokenerror=Invalid-email')
def signup(): email = request.form.get('email') name = request.form.get('name') password = request.form.get('password') confirmation= request.form.get('confirmation') if email and name and password and confirmation: if password == confirmation: code, token = self.CreateNewUser(email, name, password) if code == 1: send_mail(email, 'Food Truck: Verification Token', render_template('emails/verifyemail.html', email=email, token=quote(token))) return redirect('/index?success=An-email-with-your-verification-token-has-been-sent') elif code == 2: return redirect('/register?signuperror=Email-address-is-already-in-use') elif code == 3: return redirect('/register?signuperror=Name-is-already-in-use') else: return redirect('/register?signuperror=Both-name-and-email-is-already-in-use') else: return redirect('/register?signuperror=Password-and-confirmation-needs-to-match') else: return redirect('/register?signuperror=All-fields-needs-to-be-filled-out')
def wait_for_verify(): return render_template('autoverify.html')
def verifyuser(): return render_template('verificationpage.html')
def register(): email, code = self.retAUTHCODE(request.cookies.get('loginsession')) if code == 0 or code == 1: return redirect('/dashboard') else: return render_template('register.html')