Exemplo n.º 1
0
 def changePassword(self, user_id, password):
     """
         user_id(int): should be valid user id
         password(str): new voip password of user
     """
     password = Password(password)
     self.__changePasswordCheckInput(password)
     self.__updatePasswordDB(user_id, password.getPassword())
     user_main.getActionManager().broadcastChange([user_id])
Exemplo n.º 2
0
 def __processAuthParams(self):
     """    
         check for auth_type auth_name and auth_pass in params
     """
     self.auth_name=self.params["auth_name"]
     self.auth_pass=Password(self.params["auth_pass"])
     self.auth_type=self.params["auth_type"]
     del(self.params["auth_name"],self.params["auth_pass"],self.params["auth_type"])
Exemplo n.º 3
0
    def changePassword(self, request):
        request.needAuthType(request.ADMIN, request.NORMAL_USER)

        if request.hasAuthType(request.ADMIN):
            loaded_user = user_main.getUserPool().getUserByNormalUsername(
                request["normal_username"])
            request.getAuthNameObj().canChangeNormalAttrs(loaded_user)
            user_id = loaded_user.getUserID()
        else:
            user_id = request.getAuthNameObj().getUserID()
            self.__checkOldPassword(request.getAuthNameObj(),
                                    request["old_password"])

        password = Password(request["password"])

        self.__changePasswordCheckInput(password)
        self.__updatePasswordDB(user_id, password.getPassword())
        user_main.getActionManager().broadcastChange([user_id])
Exemplo n.º 4
0
 def __parseVoIPAttrs(self):
     self.usernames = map(None, MultiStr(self.voip_username))
     if self.generate_password == 0:
         pass_multi = MultiStr(self.voip_password)
         self.passwords = map(lambda x: Password(pass_multi[x]),
                              range(len(self.usernames)))
     else:
         self.passwords = getPasswords(len(self.usernames),
                                       self.generate_password,
                                       self.password_len)
Exemplo n.º 5
0
    def login(self,request):
        request.checkArgs("login_auth_name","login_auth_type","login_auth_pass")
        if request["login_auth_type"]==request.ADMIN:
            admin_main.getLoader().getAdminByName(request["login_auth_name"]).checkAuth(Password(request["login_auth_pass"]),\
                                      request.getRemoteAddr())

        elif request["login_auth_type"]==request.NORMAL_USER:
            user_main.getServerAuth().checkAuth(request["login_auth_name"],Password(request["login_auth_pass"]),request["login_auth_type"])
            
        elif request["login_auth_type"]==request.VOIP_USER:
            user_main.getServerAuth().checkAuth(request["login_auth_name"],Password(request["login_auth_pass"]),request["login_auth_type"])
            
        elif request["login_auth_type"]==request.MAIL:
            pass

        elif request["login_auth_type"]==request.ANONYMOUS:
            pass

        else:
            raise GeneralException(errorText("GENERAL","ACCESS_DENIED"))

        return True
                
Exemplo n.º 6
0
 def checkPassword(self, username, password):
     loaded_user = user_main.getUserPool().getUserByVoIPUsername(username)
     return Password(
         loaded_user.getUserAttrs()["voip_password"]) == password
Exemplo n.º 7
0
 def __checkOldPassword(self, loaded_user, old_password):
     if not Password(
             old_password) == loaded_user.getUserAttrs()["voip_password"]:
         raise GeneralException(
             errorText("USER_ACTIONS", "WRONG_OLD_PASSWORD"))