This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding=utf-8 | |
import time | |
from datetime import datetime | |
from threading import Thread | |
from redis import StrictRedis | |
from redis.exceptions import ConnectionError | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def require_no_login(f): | |
@wraps(f) | |
def wrapper(*args, **kwargs): | |
if current_user.is_authenticated: | |
if request.method == 'POST': | |
return jsonify(success=False, error_msg='已经登录') | |
return redirect('/') | |
return f(*args, **kwargs) | |
return wrapper |