Skip to content

Auth

change_password(zucp, request, credentials) async

Change password

Source code in mycxo/boxtalk/routes/api/auth/route.py
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
@auth_router.put("/password")
@requires_auth
async def change_password(
    zucp: ZitadelUserChangePassword,
    request: Request,
    credentials: Annotated[HTTPAuthorizationCredentials, Depends(http_bearer)],
):
    """
    Change password
    """
    try:
        await zitadel_change_password(zucp, credentials)
        return {"message": "Password changed successfully."}
    except HTTPException as e:
        raise e
    except Exception:
        raise HTTPException(status_code=500, detail="An internal error occurred.")

login(authRequest) async

Login to the API.

Source code in mycxo/boxtalk/routes/api/auth/route.py
44
45
46
47
48
49
50
51
52
53
54
55
@auth_router.get("/login/{authRequest}")
async def login(authRequest: str):
    """
    Login to the API.
    """
    token_utils = TokenUtils(
        ServiceUserCertificate.from_certificate_path(zitadel_settings.cert or "")
    )
    creds = token_utils.exchange_token()
    access_token = creds["access_token"]
    data = authorize(authRequest, access_token)
    return JSONResponse(content=data)

reset_password(zurp) async

Reset password

Source code in mycxo/boxtalk/routes/api/auth/route.py
144
145
146
147
148
149
150
151
152
153
154
155
@auth_router.patch("/password")
async def reset_password(zurp: ZitadelUserResetPassword):
    """
    Reset password
    """
    try:
        await zitadel_reset_password(zurp)
        return {"message": "Password reset link sent successfully."}
    except HTTPException as e:
        raise e
    except Exception:
        raise HTTPException(status_code=500, detail="An internal error occurred.")