Esempio n. 1
0
 def Login(self, request, context):
     authToken = handleLogin(request.name, request.password)
     if(authToken == "Password does not match."):
         return (account_pb2.LoginReply(message='Authentication failure, %s' % authToken, token=None, isAdmin="False"))
     else:
         adminCheck = isAdmin(request.name)
         return (account_pb2.LoginReply(message='Login is Successful! Your authentication token is: %s.' % authToken, token=authToken, isAdmin=adminCheck))
Esempio n. 2
0
 def Update(self, request, context):
     isUpdated = handleUpdate(request.name, request.password,
                              request.newPassword, request.authentication)
     if (isUpdated[0]):
         return (account_pb2.LoginReply(
             message='Password Update Successful! %s' % isUpdated[1]))
     return (account_pb2.LoginReply(
         message='Password Update Unsuccessful. %s' % isUpdated[1]))
Esempio n. 3
0
 def Delete(self, request, context):
     isDeleted = handleDelete(request.name, request.password,
                              request.authentication)
     if (isDeleted[0]):
         return (account_pb2.LoginReply(message='Deletion Successful! %s' %
                                        isDeleted[1]))
     return (account_pb2.LoginReply(message='Deletion Unsuccessful. %s' %
                                    isDeleted[1]))
Esempio n. 4
0
 def AdminUpdate(self, request, context):
     if (handleLogin(request.adminUser, request.token) !=
             "Authentication failure, username does not exist."):
         isUpdated = handleAdminUpdate(request.name, request.newName,
                                       request.newPass)
         if (isUpdated[0]):
             return (account_pb2.LoginReply(
                 message='Password Update Successful! %s' % isUpdated[1]))
     return (account_pb2.LoginReply(
         message='Password Update Unsuccessful.'))