コード例 #1
0
ファイル: views.py プロジェクト: ruitian/VirtualJudge
 def get(self):
     token = current_user.generate_confirmation_token()
     send_email.delay(
         current_user.email,
         'Confirm Your Account',
         'auth/email/confirm',
         user=current_user,
         token=token
     )
     flash('A new confirmation email has been sent to you by email')
     return redirect(url_for('index.index'))
コード例 #2
0
ファイル: register.py プロジェクト: ruitian/VirtualJudge
 def post(self):
     form = RegisterForm()
     if not form.validate():
         return render_template(self.template, form=form)
     user = form.register()
     token = user.generate_confirmation_token()
     send_email.delay(
         user.email,
         'Confirm Your Account',
         'auth/email/confirm',
         user=user,
         token=token
     )
     flash('A confirmation email has been sent to you by email')
     login_user(user)
     return redirect(url_for('index.index'))
コード例 #3
0
ファイル: password.py プロジェクト: ruitian/VirtualJudge
 def post(self):
     form = PasswordResetRequestForm()
     if not form.validate():
         return render_template(self.template, form=form)
     user = UserModel.objects(email=form.email.data).first()
     if user:
         token = user.generate_reset_token()
         send_email.delay(
             user.email,
             'Reset Your Password',
             'auth/email/reset_password',
             user=user, token=token,
             next=request.args.get('next')
         )
     flash('An email with instructions to reset your password has been '
           'sent to you.')
     return redirect(url_for('index.index'))