def reset_request(): # Make sure user is logged out to view this # Check if user is already logged in with current_user variable from flask login module downloaded if current_user.is_authenticated: return redirect('home') # GET request, Initialize form to be filled on reset_token.html wich will be sent to user email on form submit form = RequestResetForm() # If form was submitted with POST request and validated if form.validate_on_submit(): # Get user data from form and check database for the user information user = User.query.filter_by(email=form.email.data).first() # Use function created above to send the user an email with the token url to reset their password send_reset_email(user) # Successful email sent with instructions flash( 'An email has been sent with instructions to reset your password', 'info') # Redirect back to login page return redirect(url_for('users.login')) # Get request show reset password token form return render_template('users/reset_request.html', title='Reset Password', form=form)
def reset_request(): if current_user.is_authenticated: return redirect(url_for("home")) form = RequestResetForm() if form.validate_on_submit(): user = User.query.filter_by(email=form.email.data).first() flash("An email was 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('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 with instructions has been sent', 'info') return redirect(url_for('login')) return render_template('request_reset.html', form=form, title='Reset Password')
def reset_request(): if current_user.is_authenticated: return redirect(url_for('main.home_page')) form = RequestResetForm() if form.validate_on_submit(): user = User.query.filter_by(email=form.email.data).first() send_reset_email(user) flash('Check your email for a link to reset password', 'info') return redirect(url_for('users.login_page')) 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('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 = RequestResetForm() if form.validate_on_submit(): user = User.query.filter_by(email=form.email.data).first() send_reset_email(user) flash('Yönlendirmeleri içeren bir e-posta, hesabınıza gönderildi.', 'info') return redirect(url_for('users.login')) return render_template('reset_request.html', title='Şifreyi yenile', 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) # Commenting this out, don't need to actually send emails 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 = RequestResetForm() if form.validate_on_submit(): user = User.query.filter_by(email=form.email.data).first() send_reset_mail(user) flash('Şifre yenileme talebiniz için e-posta adresinize link gönderildi.', 'info') return redirect(url_for('users.login')) return render_template('reset_request.html', form=form, legend='Şifre Yenileme')
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('בדקו את המייל שלכם!', '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(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 registered email id with reset password instructions. If not found in your inbox, please check your spam folder', 'info') return redirect(url_for('users.login')) return render_template('reset_request.html', title='Reset password', form=form, prof_pic=firebase_storage.prof_img(current_user))
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 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 = RequestResetForm() if form.validate_on_submit(): user = User.query.filter_by(email=form.email.data).first() send_reset_email(user) flash('Email telah dikirim dengan instruksi untuk mereset 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 = RequestResetForm() if form.validate_on_submit(): user = User.query.filter_by(email = form.email.data).first() send_reset_email(user) flash(f'A email has been sent to your mail','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('main.home')) form = RequestResetForm() if form.validate_on_submit(): user = User.query.filter_by(email=form.email.data).first() send_reset_email(user) flash('Te hemos enviado un email con indicaciones para cambiar tu contraseña', 'info') return redirect(url_for('users.login')) return render_template('reset_request.html', title='Cambiar contraseña', form=form)
def reset_request(): if current_user.is_authenticated: return redirect(url_for(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 redirect(url_for(LOGIN)) return render_template('reset_request.html', title="Reset Password", form=form)
def reset_request(): # import pdb;pdb.set_trace() 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 sent with reset your password','info') return redirect(url_for("users.login")) return render_template('reset_request.html', title = 'Reset Password', form = form)
def RequestResetPassword(): 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'Reset has been sent to {user.email}', category='info') 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() # print("reset_request: ", user) send_reset_email(user) flash("An email has been send 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 = RequestResetForm() if form.validate_on_submit(): for query in User.objects(email=form.email.data): user = query 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(): """this is where they request the email for a reset""" 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 redirect(url_for("users.login")) return render_template("reset_request.html", title="Reset Password", form=form)
def reset_required(): 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('Email sent for Password reset.', 'info') return redirect(url_for('user.login')) return render_template('reset_request.html', title='Reset Password', form=form)
def reset_request(): if current_user.is_authenticated: #if logged in, redirect user to home 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('Email for password reset sent! Check your inbox.', 'info') return redirect(url_for('users.login')) return render_template('reset_request.html', title='Reset Password', form=form)
def reset_request(): # user login check 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() token = user.get_reset_token() send_reset_email(user, token) flash('An email has been sent with instructions to reset you password', 'info') return redirect(url_for('users.login')) return render_template('reset_request.html', title='Reset Password', form=form)
def reset_request(): 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 redirect(url_for('users.login')) return render_template('reset_request.html', title='Reset Password', form=form)
def reset_request(): if current_user.is_authenticated: # user is already logged in, no need to show them password reset request page return redirect(url_for('posts.posts')) form = RequestResetForm() if form.validate_on_submit(): # user entered a valid email and also one that's on the database. we now send them an email 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 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('base.home')) form = RequestResetForm() if form.validate_on_submit(): #validate user user = User.query.filter_by(email=form.email.data).first() send_reset_email(user) # send email with link to reset pswd flash('An email has been sent with instructions') return redirect(url_for('users.login')) return render_template('reset_request.html', title='Forgot 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, Check out your inbox!", "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: flash('You must be logged out before resetting password', 'info') 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'An email has been sent with password reset instructions to the email {user.email}', '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() if user: send_reset_email(user) flash('If the email exist, you will receive a confirmation email soon.', 'info') return redirect(url_for('users.login')) return render_template('users/reset_request.html', title='Reset Password', form=form)
def author_mail(): random_code = '123456' code = generateOTP() email = request.args['email'] user = User.query.filter_by(email=email).first() # if current_user.is_authenticated: # return redirect(url_for('home')) form = RequestResetForm() if form.validate_on_submit(): if random_code == form.emailcode.data: login_user(user) return redirect(url_for('main.home')) return render_template('author_mail.html', title='very Code', 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 Reset Email sent to Your email address, check your inbox.', 'info') return (redirect(url_for('users.login'))) return render_template('reset_request.html', title='Password Reset', form=form)