Пример #1
0
 def get(self):
     self.render('Login.html')
     user = users.get_current_user()
     if user:
         if(functions.auth_user(user.email())):
             self.redirect('/newpost')
         else:
             self.redirect(users.create_logout_url('/'))
Пример #2
0
 def get(self):
     self.render('Login.html')
     user = users.get_current_user()
     if user:
         if (functions.auth_user(user.email())):
             self.redirect('/newpost')
         else:
             self.redirect(users.create_logout_url('/'))
Пример #3
0
 def insert_user(self, user):
     if (functions.auth_user(user.email)):
         user.put()
         return user
     else:
         raise endpoints.UnauthorizedException(
             'This method requires you to be authenticated. You may need to activate the toggle above to authorize your request using OAuth 2.0.'
         )
Пример #4
0
    def singin_user(self, request):
        current_user = request.email
        if current_user is None:
            raise endpoints.UnauthorizedException('No user is logged in.')

        if (functions.auth_user(current_user)):
            return (LoginResponse(signedIn=True))
        else:
            raise endpoints.UnauthorizedException('Ivalid token.')
Пример #5
0
 def permission_user(self,request):
     current_user = request.email
     if current_user is None:
         raise  endpoints.UnauthorizedException('Invalid token.')
     
     if (functions.auth_user(current_user)):
         return PermissionResponse(permission = functions.permission_user(current_user))
     else:
         raise endpoints.UnauthorizedException('Invalid token.')
Пример #6
0
 def singin_user(self,request):
     current_user = request.email
     if current_user is None:
         raise endpoints.UnauthorizedException('No user is logged in.')
 
     if (functions.auth_user(current_user)):
         return (LoginResponse(signedIn = True))
     else:
         raise endpoints.UnauthorizedException('Ivalid token.')
Пример #7
0
    def permission_user(self, request):
        current_user = request.email
        if current_user is None:
            raise endpoints.UnauthorizedException('Invalid token.')

        if (functions.auth_user(current_user)):
            return PermissionResponse(
                permission=functions.permission_user(current_user))
        else:
            raise endpoints.UnauthorizedException('Invalid token.')
Пример #8
0
 def insert_user(self, _user):
     if (functions.auth_user(_user.email)):
         user_key = ndb.Key('AIESEC','User')
         u = User.get_user()
                 
         if _user.user_id in u:
             raise endpoints.InternalServerErrorException()
         else:
             user = User(parent = user_key, user_id = _user.user_id,
                         email = _user.email, user = _user.user,
                         university = _user.university, state = _user.state)
             user.put()
             User.get_user(True)
             return _user
     else:
         raise endpoints.UnauthorizedException('This method requires you to be authenticated. You may need to activate the toggle above to authorize your request using OAuth 2.0.')
Пример #9
0
    def insert_user(self, _user):
        if (functions.auth_user(_user.email)):
            user_key = ndb.Key('AIESEC', 'User')
            u = User.get_user()

            if _user.user_id in u:
                return _user
            else:
                user = User(parent=user_key,
                            user_id=_user.user_id,
                            email=_user.email,
                            user=_user.user,
                            university=_user.university,
                            state=_user.state)
                user.put()
                User.get_user(True)
                return _user
        else:
            raise endpoints.UnauthorizedException(
                'This method requires you to be authenticated. You may need to activate the toggle above to authorize your request using OAuth 2.0.'
            )
Пример #10
0
 def insert_user(self, user):
     if (functions.auth_user(user.email)):
         user.put()
         return user
     else:
         raise endpoints.UnauthorizedException('This method requires you to be authenticated. You may need to activate the toggle above to authorize your request using OAuth 2.0.')