示例#1
0
    def get(self, token):
        try:
            ts.loads(token, salt=app.config["MAIL_RESET_SALT"], max_age=app.config["MAIL_RESET_MAX_AGE"])
        except:
            print "sfsdfsfsfd"
            abort(404)
        form = PasswordForm()

        return render_template("www/reset_with_token.html", form=form, token=token)
示例#2
0
    def get(self, token):
        try:
            email = ts.loads(token, salt=app.config["MAIL_CONFIRM_SALT"], max_age=app.config["MAIL_CONFIRM_MAX_AGE"])
        except:
            abort(404)

        account = AccountModel.query.filter_by(email=email).first_or_404()
        account.is_email_confirmed = True
        db.session.commit()

        return redirect(url_for("views.login"))
示例#3
0
    def post(self, token):
        try:
            email = ts.loads(token, salt=app.config["MAIL_RESET_SALT"], max_age=app.config["MAIL_RESET_MAX_AGE"])
        except:
            abort(404)
        form = PasswordForm()
        if form.validate_on_submit():
            account = AccountModel.query.filter_by(email=email).first_or_404()
            account.password = form.password.data
            db.session.commit()
            return redirect(url_for("views.login"))
        else:
            flash_errors(form)

        return render_template("www/reset_with_token.html", form=form, token=token)