def post(self, user_id): user = User.query.get_or_404(user_id) form = RecoverForm(email=user.email) if form.validate(): form.save() send_reset_mail(user.email, user.recover_token) flash('The reset email has been sent successfully', 'success') return jsonify(status="success", url=url_for('.users'))
def post(self): form = auth.RecoverForm(request.form) if form.validate(): user = form.save() send_reset_mail(user.email, user.recover_token) flash('Please check your email', 'success') return redirect(url_for('auth.login')) return render_template('auth/forgot_password.html', form=form)