Exemplo n.º 1
0
def before_app_request():
    current_user.flush_access_time()
    if current_user.is_authenticated and \
        not current_user.confirmed and \
        request.endpoint[:5] != 'auth.' \
        and request.endpoint != 'static':
        return redirect(url_for('auth.unconfirmed'))
Exemplo n.º 2
0
def before_app_request():
    #什么样的用户我们才截获?
    #1.已经登陆 and 没有认证 and 访问的不是auth.和stastic
    #print(request.endpoint)
    current_user.flush_access_time()
    if current_user.is_authenticated and \
        not current_user.confirmed and \
        request.endpoint[:5] != 'auth.' and \
        request.endpoint != 'static' :
        #注意:访问其他蓝本的时候,比如main蓝本时候,当前蓝本就是main
        return redirect(url_for('auth.unconfirmed'))
Exemplo n.º 3
0
def before_request():
    if current_user.is_authenticated:
        current_user.flush_access_time()
    if current_user.is_authenticated and not current_user.confirmed and request.endpoint[:
                                                                                         5] != 'auth.':
        return redirect(url_for('auth.unconfirm'))