def confirm(): if current_user.is_confirmed: return 'you are already confirmed' token = current_user.get_serializer_token(salt='e-mail confirmation') send_email( subject='e-mail confirmation', to=current_user.email, text_body= 'if you are getting this it means you are unable to see html page please contact admin', template='confirm', token=token) return '<h1>An confirmation mail has been send to e-mail. Check your inbox</h1>'
def confirm(): if current_user.is_confirmed: flash("You are already confirm", "info") return redirect(url_for('main.home')) token = current_user.get_serializer_token(salt='e-mail confirmation') send_email( subject='e-mail confirmation', to=current_user.email, text_body= 'if you are getting this it means you are unable to see html page please contact admin', template='confirm', token=token) flash( f'An confirmation e-mail has been send to {current_user.email}, Please confirm E-Mail', 'info') return redirect(url_for('main.home'))
def reset(): if current_user.is_authenticated: return 'you need to logout to access this page' form = ResetForm() if form.validate_on_submit(): user = User.query.filter_by(username=form.username.data).first_or_404() if user: token = user.get_serializer_token(salt='password reset') send_email( subject='password reset', to=user.email, text_body= 'if you are getting this it means you are unable to see html page please contact admin', template='reset', token=token) return '<h1>Mail has been send. Check your inbox</h1>' return render_template('reset.html', form=form)
def reset(): if current_user.is_authenticated: flash("You need to logout to access this page", "warning") return redirect(url_for('main.home')) form = ResetForm() if form.validate_on_submit(): user = User.query.filter_by(username=form.username.data).first_or_404() if user: token = user.get_serializer_token(salt='password reset') send_email( subject='password reset', to=user.email, text_body= 'if you are getting this it means you are unable to see html page please contact admin', template='reset', token=token) flash( f"A mail has been sent to {user.email} with reset information", "info") return redirect(url_for('user.login')) return render_template('reset.html', form=form)