def reset_request(): if current_user.is_authenticated: return redirect(url_for('main.home')) form = RequestResetForm() if form.validate_on_submit(): user = User.query.filter_by(email=form.email.data).first() send_reset_email(user) flash('An email has been sent with instructions to reset your password.', 'info') return render_template('reset_request.html', title='Reset password ', form=form)
def reset_request(): if current_user.is_authenticated: return redirect(url_for('home_blueprint.home')) form = RequestResetForm() if form.validate_on_submit(): user = User.query.filter_by(email=form.email.data).first() send_reset_email(user) flash('Email sent with instructions to reset your password.', 'info') return redirect(url_for('users_blueprint.login')) return render_template('reset_request.html', form=form)
def reset_request(): if current_user.is_authenticated: return redirect(url_for('main.home')) form = RecoverForm() if form.validate_on_submit(): user = Blogger.query.filter_by(email=form.email.data).first() send_reset_email(user) flash('An email to reset your password was sent.', 'info') return redirect(url_for('users.login')) return render_template('reset_request.html', form=form)
def reset_request(): if current_user.is_authenticated: return redirect_for(url_for('main.home')) form = RequestResetForm() if form.validate_on_submit(): user = User.query.filter_by(email=form.email.data).first() send_reset_email(user) flash('A reset email has been reset with instructions! Make sure you check your spam folder!', 'info') return redirect(url_for('users.login')) return render_template('reset_request.html', title='Reset Password', form=form)
def reset_request(): if current_user.is_authenticated: return redirect(url_for('main.logged_in', user=current_user.username)) form = RequestResetForm() if form.validate_on_submit(): user = User.query.filter_by(email=form.email.data).first() send_reset_email(user) # email has been sent message return redirect(url_for('users.login')) return render_template('reset_request.html', form=form)
def reset_request(): if current_user.is_authenticated: return redirect(url_for('main.home')) form = RequestResetForm() if form.validate_on_submit(): user = User.query.filter_by(email=form.email.data).first() send_reset_email(user) flash('%s' % flashM.userResetPasswordMail, 'info') return redirect(url_for('users.login')) return render_template('reset_request.html', title='Reset Password', form=form)
def reset_request(): if current_user.is_authenticated: return redirect(url_for("main.home")) form = RequestResetForm() if form.validate_on_submit(): user = User.query.filter_by(email=form.email.data).first() send_reset_email(user) flash(f"Please check your email", category="info") return redirect(url_for("users.login")) return render_template("reset_request.html", title="Reset Password", form=form)
def request_reset_email(): if current_user.is_authenticated: return redirect(url_for('main.index')) form = email_reset_pass() if form.validate_on_submit(): user = User.query.filter_by( email=form.email.data.lower()).first_or_404() send_reset_email(user) flash('Email has been sent to ' + form.email.data.lower(), 'info') return redirect(url_for('users.login')) return render_template('login/request_reset.html', title='Reset Password', form=form)
def reset_request(): if current_user.is_authenticated: return redirect(url_for('main.home')) form = RequestResetForm() if form.validate_on_submit(): user = User.query.filter_by(Email=form.email.data).first() # Call the function that will generate the email and token for the reset password. send_reset_email(user) flash("An email has been sent you can reset your email now.", 'success') return redirect(url_for('users.login')) return render_template('reset-request.html', title='Reset Password', form=form)
def reset_request(): if current_user.is_authenticated: return redirect(url_for('posts.access')) form = RequestResetForm() if form.validate_on_submit(): user = User.query.filter_by(email=form.email.data).first() utils.send_reset_email(user) flash('An email with a link has been sent to reset the password', 'info') return redirect(url_for('users.signin')) return render_template('reset_request.html', title='Price Tracker-Reset Password', form=form)
def reset_request(): if current_user.is_authenticated: return redirect(url_for('main.home')) form = RequestResetForm() if form.validate_on_submit(): user = User.query.filter_by(email=form.email.data).first() send_reset_email(user) flash( 'An email has been sent to your email account to help with passeord reset.', 'info') return redirect(url_for('main.login')) return render_template('reset_request.html', title='Request Password', form=form)
def reset_request(): if current_user.is_authenticated: return redirect(url_for("main.home")) form = RequestResetForm() if form.validate_on_submit(): user = User.query.filter_by(form.email.data).first() send_reset_email(user) flash( "An email has been sent with instructions to reset your password", "info") return redirect(url_for("users.login")) return render_template("reset_request.html", title="Reset Password", form=form)
def reset_request(): if current_user.is_authenticated: return redirect(url_for('main.home')) form = request_reset_password() if form.validate_on_submit(): user = User.query.filter_by(email=form.email.data).first() send_reset_email(user) flash(f'An reset password link have been sent to the registered mail', 'info') return redirect(url_for('users.login')) return render_template('reset_request.html', title="Reset Password", form=form, announcements=Announcments.query.order_by( Announcments.date_posted.desc()).paginate( page=1, per_page=10))
def reset_request(): """ Password reset request """ if current_user.is_authenticated: return redirect(url_for('main.index')) if request.method == "POST": email = request.form.get('email') user = User.query.filter_by(email=email).first() if user is None: flash('There is no account with that email. Please register first.') return redirect(url_for('users.passwordreset')) send_reset_email(user) flash('An email has been sent with instructions to reset your password. You may need to check your SPAM/junk folder.') return redirect(url_for('users.login')) return render_template('reset_request.html')
def reset_request(): # We don't want the user to be logged in here if current_user.is_authenticated: return redirect(url_for('main.home')) form = RequestResetForm() if form.validate_on_submit(): user = User.query.filter_by(email=form.email.data).first() if user is None: flash('No such user exists in our database', 'warning') return redirect(url_for('users.login')) send_reset_email(user) flash('An email with instructions to reset your password has been sent.', 'info') return redirect(url_for('users.login')) return render_template('reset_request.html', title='Reset Password', form=form)
def request_password_reset(): if current_user.is_authenticated: return redirect(url_for('main.home')) form = RequestPasswordResetForm() if request.method == 'GET': return render_template('req_password_reset.html', title='Reset Password', form=form) elif request.method == 'POST': if form.validate_on_submit(): user = User.query.filter_by(email=form.email.data).first() if user: send_reset_email(user) # The user gets the same message displayed, even if no user exist with the provided email # This reduces the info given to an attacker trying to enumerate existing accounts flash( 'An email with the instructions has been sent to the specified email address', 'success') return redirect(url_for('main.home'))