feat(api): changed change password response
This commit is contained in:
parent
bec4bc37d5
commit
f147ab0bd1
2 changed files with 43 additions and 4 deletions
|
|
@ -426,8 +426,27 @@ def change_password(tenant_id, user_id, email, old_password, new_password):
|
|||
if auth is None:
|
||||
return {"errors": ["wrong password"]}
|
||||
changes = {"password": new_password, "generatedPassword": False}
|
||||
return {"data": update(tenant_id=tenant_id, user_id=user_id, changes=changes),
|
||||
"jwt": authenticate(email, new_password)["jwt"]}
|
||||
user = update(tenant_id=tenant_id, user_id=user_id, changes=changes)
|
||||
r = authenticate(user['email'], new_password)
|
||||
tenant_id = r.pop("tenantId")
|
||||
|
||||
r["limits"] = {
|
||||
"teamMember": -1,
|
||||
"projects": -1,
|
||||
"metadata": metadata.get_remaining_metadata_with_count(tenant_id)}
|
||||
|
||||
c = tenants.get_by_tenant_id(tenant_id)
|
||||
c.pop("createdAt")
|
||||
c["projects"] = projects.get_projects(tenant_id=tenant_id, recording_state=True, recorded=True,
|
||||
stack_integrations=True)
|
||||
c["smtp"] = helper.has_smtp()
|
||||
return {
|
||||
'jwt': r.pop('jwt'),
|
||||
'data': {
|
||||
"user": r,
|
||||
"client": c
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def set_password_invitation(user_id, new_password):
|
||||
|
|
|
|||
|
|
@ -436,8 +436,27 @@ def change_password(tenant_id, user_id, email, old_password, new_password):
|
|||
if auth is None:
|
||||
return {"errors": ["wrong password"]}
|
||||
changes = {"password": new_password, "generatedPassword": False}
|
||||
return {"data": update(tenant_id=tenant_id, user_id=user_id, changes=changes),
|
||||
"jwt": authenticate(email, new_password)["jwt"]}
|
||||
user = update(tenant_id=tenant_id, user_id=user_id, changes=changes)
|
||||
r = authenticate(user['email'], new_password)
|
||||
|
||||
tenant_id = r.pop("tenantId")
|
||||
r["limits"] = {
|
||||
"teamMember": -1,
|
||||
"projects": -1,
|
||||
"metadata": metadata.get_remaining_metadata_with_count(tenant_id)}
|
||||
|
||||
c = tenants.get_by_tenant_id(tenant_id)
|
||||
c.pop("createdAt")
|
||||
c["projects"] = projects.get_projects(tenant_id=tenant_id, recording_state=True, recorded=True,
|
||||
stack_integrations=True)
|
||||
c["smtp"] = helper.has_smtp()
|
||||
return {
|
||||
'jwt': r.pop('jwt'),
|
||||
'data': {
|
||||
"user": r,
|
||||
"client": c,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def set_password_invitation(tenant_id, user_id, new_password):
|
||||
|
|
@ -457,6 +476,7 @@ def set_password_invitation(tenant_id, user_id, new_password):
|
|||
c.pop("createdAt")
|
||||
c["projects"] = projects.get_projects(tenant_id=tenant_id, recording_state=True, recorded=True,
|
||||
stack_integrations=True)
|
||||
c["smtp"] = helper.has_smtp()
|
||||
return {
|
||||
'jwt': r.pop('jwt'),
|
||||
'data': {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue