Password recovery: new text and automatic tab change when password is sent.

This commit is contained in:
Philippe Pittoli 2024-03-21 00:46:55 +01:00
parent f9a471c580
commit a5756e41af
2 changed files with 20 additions and 4 deletions

View File

@ -520,8 +520,9 @@ handleAction = case _ of
(AuthD.GotError errmsg) -> do
handleAction $ Log $ ErrorLog $ " generic error message: "
<> maybe "server didn't tell why" (\v -> v) errmsg.reason
(AuthD.GotPasswordRecoverySent _) -> do
m@(AuthD.GotPasswordRecoverySent _) -> do
handleAction $ Log $ SuccessLog $ "Password recovery: email sent!"
handleAction $ DispatchAuthDaemonMessage m
(AuthD.GotErrorPasswordTooShort _) -> do
handleAction $ Log $ ErrorLog "Password too short!"
(AuthD.GotErrorMailRequired _) -> do
@ -566,6 +567,7 @@ handleAction = case _ of
DispatchAuthDaemonMessage message -> do
{ current_page } <- H.get
case current_page of
Authentication -> H.tell _ai unit (AI.MessageReceived message)
Administration -> H.tell _admini unit (AdminInterface.MessageReceived message)
_ -> handleAction $ Log $ SystemLog "unexpected message from authd"
pure unit

View File

@ -203,8 +203,20 @@ render { wsUp, current_tab, authenticationForm, passwordRecoveryForm, newPasswor
<> " (currently: " <> show n <> ")"
auth_form = [ Bulma.h3 "Authentication", render_auth_form ]
passrecovery_form = [ Bulma.h3 "Password Recovery", render_password_recovery_form ]
newpass_form = [ Bulma.h3 "New password", render_new_password_form ]
passrecovery_form =
[ Bulma.h3 "Password Recovery"
, Bulma.div_content
[ Bulma.p "You forgot your password? Ask for a password recovery token!"
]
, render_password_recovery_form
]
newpass_form =
[ Bulma.h3 "You got the recovery mail and have a token"
, Bulma.div_content
[ Bulma.p "Nice! You get to chose your new password."
]
, render_new_password_form
]
should_be_disabled = (if wsUp then (HP.enabled true) else (HP.disabled true))
@ -374,6 +386,8 @@ handleQuery = case _ of
-- Error messages are simply logged (see the code in the Container component).
MessageReceived message _ -> do
case message of
AuthD.GotPasswordRecoverySent _ -> do
handleAction $ ChangeTab Recovery
_ -> do
H.raise $ Log $ ErrorLog $ "Message not handled in AuthenticationInterface."
pure Nothing