def resend_confirmation(): form = ConfirmEmailForm() if form.validate_on_submit(): user = User.query.filter_by(email=form.email.data).first() if user is None: print("user none") flash("Email is not registered", "error") return redirect(url_for("auth.resend_confirmation")) if user.email_registered: print("user already reg") flash( "You have already confirmed your account. Please login below.", "success", ) return redirect(url_for("auth.login")) send_confirm_email(user) flash("A confirmation link has been sent via email.", "success") return redirect(url_for("auth.login")) return render_template( "auth/resend_token.html", title="Resend Confirmation Email", form=form )
def confirm_request(): """Respond to new user's request to confirm their account.""" send_confirm_email(current_user) flash( 'A new confirmation link has been sent to {}.'.format( current_user.email), 'green') return redirect(url_for('account.unconfirmed'))
def resend_confirm_email(): if current_user.confirmed: return redirect(url_for('main.index')) send_confirm_email(user=current_user) flash('New email sent, check your inbox.', 'info') return redirect(url_for('main.index'))
def register_submit(token=None): """Login endpoint.""" if token != "PASS360REG001": return redirect(url_for('index.index')) form = RegisterForm() if form.validate_on_submit(): email = form.email.data user = User.get(email=form.email.data) if user: flash('That email is already taken') else: user = User(email=email) user.set_password(form.password.data) db.session.add(user) db.session.commit() send_confirm_email(user) login_user(user) flash("Your account has been successfully created.") return redirect(user.get_landing_page()) return render_template('auth/register.html', title='Register', form=form, token=token)
def register(): form = RegisterForm() if current_user.is_authenticated: return redirect(url_for('admin.dashboard')) if form.validate_on_submit(): user = User(first_name=form.first_name.data, last_name=form.last_name.data, grade=form.grade.data, track=form.track.data, homeroom=form.homeroom.data, email=form.email.data) user.set_image(form.profile_image.data) user.set_password(form.password.data) db.session.add(user) db.session.commit() flash("Success, please check your email inbox for email confirmation", "alert-success") send_confirm_email(user) return redirect(url_for('admin.login')) return render_template('admin/register.html', form=form)
def register(): if current_user.is_authenticated: return redirect(url_for('main.index')) form = RegistrationForm() if form.validate_on_submit(): user = User(username=form.username.data, email=form.email.data.lower()) user.set_password(form.password.data) db.session.add(user) db.session.commit() send_confirm_email(user=user) flash('Confirm email sent, check your inbox.', 'info') return redirect(url_for('auth.login')) return render_template('auth/register.html', title=_('Register'), form=form)
def register(): if current_user.is_authenticated: return redirect(url_for('main.index')) form = RegistrationForm() if form.validate_on_submit(): user = User(username=form.username.data, phonenumber=form.phonenumber.data, email=form.email.data, isteacher=form.isteacher.data) user.set_password(form.password.data) db.session.add(user) db.session.commit() token = user.generate_confirmation_token() send_confirm_email(user) flash(_('一封待确认的邮件已发送至你的邮箱(由于部分邮箱运营商策略的问题,可能会自动归档验证邮件进入垃圾箱,如果收件箱没有收到邮件请刷新或者去垃圾箱查看)。')) return redirect(url_for('auth.login')) return render_template('auth/register.html', title=_('Register'), form=form)
def register_publisher(): # Register an new publisher and send them a confirmation email form = PublisherRegistrationForm() if form.validate_on_submit(): role = Role.query.filter_by(index='publisher').first_or_404() user = User(first_name=form.first_name.data, email=form.email.data, password=form.password.data, role=role) db.session.add(user) db.session.commit() send_confirm_email(user) login_user(user) return redirect(url_for('account.unconfirmed')) return render_template('home/register_publisher.html', form=form)
def register(): """Register new user.""" form = RegisterForm(request.form) if form.validate_on_submit(): user = User.create(username=form.username.data, email=form.email.data, password=form.password.data, active=False, locale=g.locale) session['locale'] = user.locale flash(_('Thank you for registering. Please validate your email address before logging in.'), 'success') send_confirm_email(user) return redirect(url_for('public.home')) else: flash_errors(form) return render_template('register.html', form=form)
def register(): if current_user.is_authenticated: return redirect(url_for("main.show_user", username=current_user.username)) form = RegistrationForm() if form.validate_on_submit(): user = User( username=form.username.data, email=form.email.data.lower(), player_level=form.player_level.data, player_team=form.player_team.data, email_registered=False, ) user.set_password(form.password.data) db.session.add(user) db.session.commit() send_confirm_email(user) flash("A confirmation link has been sent via email.", "success") return redirect(url_for("auth.login")) return render_template("auth/register.html", title="Register", form=form)
def resend_confirmation(): token = current_user.generate_confirmation_token() send_confirm_email(current_user) flash('一封新的确认邮件已经发送到你的邮箱') return redirect(url_for('main.index'))