Add support for user registration without autologin
Issue: pleroma#1985
Relevant BE MR: pleroma!2823 (merged)
Current FE logic when user submits registration form:
POST /api/v1/accounts
- if the response is HTTP 200, use
access_token
from the response and doGET /api/v1/accounts/verify_credentials
(even if BE response does not containaccess_token
— that mistakenly never happened in BEdevelop
if registration is successful, see pleroma!2823 (merged) for the fixed BE behaviour)
The issue with this logic is that BE may be configured to demand email confirmation and/or user account approval by instance admin, and in this case autologin is not possible at the time of registration (see pleroma#1985).
Proposed FE logic change:
POST /api/v1/accounts
- if the response is HTTP 200 and it has
access_token
, useaccess_token
from the response and doGET /api/v1/accounts/verify_credentials
(existing flow for the case when autologin was performed and token was issued) - if the response is HTTP 200 and it has no
access_token
butidentifier
andmessage
, do not hitGET /api/v1/accounts/verify_credentials
(since it's a token-demanding endpoint); instead, display message to the user and navigate to root location.
It's recommended to use identifier
(possible values: missing_confirmed_email
, awaiting_approval
, manual_login_required
, per pleroma!2823 (merged)) and display localized error message depending on it. message
field of the response is more intended for debugging.
Edited by Ivan Tashkinov