コード例 #1
0
ファイル: routes.py プロジェクト: tate11/saas-boilerplate
def confirm_email(userid):
    user = user_module.User.query.filter_by(id=uuid.UUID(userid).hex).first()
    if user:
        flash(
            'We\'ve sent you the confirmation email, please open it and click on the confirmation link.'
        )
        return render_template("confirmemail.html",
                               userid=userid,
                               company_name=current_app.config['COMPANY_NAME'])
    return error_handler.app_error(
        'User identification error',
        'Sorry but user not found. Please login or register again.')
コード例 #2
0
ファイル: routes.py プロジェクト: tate11/saas-boilerplate
def confirm(token, userid):
    user = user_module.User.query.filter_by(id=uuid.UUID(userid).hex).first()
    if user:
        if not user.confirmed:
            if user.confirm(token):
                db.session.commit()
                # User is confirmed, but we have to logout to make sure that THIS exact user will login then.
        logout_user()
        return redirect(url_for('auth.confirmed'))
    else:
        return error_handler.app_error(
            'User identification error',
            'Sorry but user not found. Please login or register again.')
コード例 #3
0
ファイル: routes.py プロジェクト: tate11/saas-boilerplate
def resend_confirmation(userid):
    user = user_module.User.query.filter_by(id=uuid.UUID(userid).hex).first()
    if user:
        token = user.generate_confirmation_token()
        send_email(user.email,
                   'Please confirm Your Email',
                   'confirmation',
                   user=user,
                   token=token,
                   company_name=current_app.config['COMPANY_NAME'])
        flash(
            'We\'ve resent you the confirmation email. Please open your mail and click the link inside.'
        )
        return render_template("confirmemail.html",
                               userid=userid,
                               company_name=current_app.config['COMPANY_NAME'])
    return error_handler.app_error(
        'User identification error',
        'Sorry but user not found. Please login or register again.')
コード例 #4
0
ファイル: routes.py プロジェクト: tate11/saas-boilerplate
def testerror():
    return error_handler.app_error('Some unknown error', 'some error text')
コード例 #5
0
ファイル: __init__.py プロジェクト: tate11/saas-boilerplate
def page_server_error(e):
    from app.utils import error_handler
    return error_handler.app_error(
        error_title='CRITICAL ERROR',
        error_text='Something went wrong... please try again.'), 500
コード例 #6
0
ファイル: __init__.py プロジェクト: tate11/saas-boilerplate
def page_not_found(e):
    from app.utils import error_handler
    return error_handler.app_error(
        error_title='PAGE NOT FOUND',
        error_text='The page you asked for not found...'), 404