def check_google_authcode(request,authcode): from users.views import get_user from vyperlogix.google.auth import pyg2fa from users.models import GoogleAuthenticator __user__ = get_user(request) auths = GoogleAuthenticator.objects.all() return pyg2fa.validate(auths[0].otpseed,authcode) if (auths.count() > 0) else False
def reload_user(self): if request.headers.has_key('Authorization') and request.endpoint: ctx = _request_ctx_stack.top ctx.user = get_user(token=request.headers['Authorization']) if ctx.user: check_user_permission(ctx.user) else: ctx.user = self.anonymous_user() else: super(CustomLoginManager,self).reload_user()
def load_user(uid): return get_user(uid)