ResetPassword now returns True or False depending if the password has been changed
This commit is contained in:
parent
77c260ebf3
commit
4e125180e0
@ -65,20 +65,6 @@ class Admin:
|
||||
|
||||
return ret
|
||||
|
||||
def authuser_reset_password(self, Id, NewPassword):
|
||||
r = self.session.post(
|
||||
"http+unix://" + self.socket_path + "/api/auth/" + quote_plus(Id) + "/reset_password",
|
||||
data=json.dumps({
|
||||
"password": NewPassword,
|
||||
})
|
||||
)
|
||||
|
||||
if r.status_code != 200:
|
||||
raise HappyError(r.status_code, **r.json())
|
||||
|
||||
from .authuser import AuthUser
|
||||
return r.json()
|
||||
|
||||
def authuser_udpate(self, Id, au):
|
||||
r = self.session.put(
|
||||
"http+unix://" + self.socket_path + "/api/auth/" + quote_plus(Id),
|
||||
|
@ -14,8 +14,18 @@ class AuthUser:
|
||||
def Delete(self):
|
||||
self._session.authuser_delete(self.Id)
|
||||
|
||||
def ResetPassword(self, *args, **kwargs):
|
||||
self._session.authuser_reset_password(self.Id, *args, **kwargs)
|
||||
def ResetPassword(self, Id, NewPassword):
|
||||
r = self.session.post(
|
||||
"http+unix://" + self.socket_path + "/api/auth/" + quote_plus(Id) + "/reset_password",
|
||||
data=json.dumps({
|
||||
"password": NewPassword,
|
||||
})
|
||||
)
|
||||
|
||||
if r.status_code != 200 and r.status_code != 406:
|
||||
raise HappyError(r.status_code, **r.json())
|
||||
|
||||
return r.status_code == 200
|
||||
|
||||
def Update(self):
|
||||
self._session.authuser_update(self.Id, self)
|
||||
|
Loading…
x
Reference in New Issue
Block a user