Пример #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)