def update_user_password(self, user_id, new_password): user = Users.objects.get(user_id=user_id) if len(new_password) < 8: raise PasswordTooShortError("密码不能小于8位") user.set_password(new_password) user.save() # 同时修改git的密码 codeRepositoriesService.modifyUser(user, new_password)
def update_password(self, user_id, new_password): u = user_repo.get_user_by_user_id(user_id=user_id) if not u: raise AccountNotExistError("账户不存在") else: if len(new_password) < 8: raise PasswordTooShortError("密码不能小于8位") u.set_password(new_password) u.save() return True, "password update success"