Exemple #1
0
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
Exemple #2
0
    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()
Exemple #3
0
def load_user(uid):
    return get_user(uid)