Error messages, again.
This commit is contained in:
parent
60552fff1e
commit
da2a26825a
@ -537,6 +537,7 @@ handleAction = case _ of
|
||||
_ -> handleAction $ DispatchAuthDaemonMessage m
|
||||
(AuthD.GotUserEdited u) -> do
|
||||
handleAction $ Log $ SuccessLog $ "User (" <> show u.uid <> ") was modified."
|
||||
handleAction $ AddNotif $ GoodNotification "Modification done."
|
||||
(AuthD.GotUserValidated _) -> do
|
||||
handleAction $ Log $ SuccessLog "User got validated. You can now log in."
|
||||
handleAction $ Routing Authentication
|
||||
|
@ -175,7 +175,7 @@ show_error_title_label v = case v of
|
||||
|
||||
show_error_login :: L.Error -> String
|
||||
show_error_login = case _ of
|
||||
L.ParsingError {error} -> maybe "login is invalid, it should respect the following regex: [a-zA-Z][-_ a-zA-Z0-9']*[a-zA-Z0-9]" string_error_login error
|
||||
L.ParsingError {error} -> maybe "login is invalid, it should match the following regex: [a-zA-Z][-_ a-zA-Z0-9']*[a-zA-Z0-9]" string_error_login error
|
||||
|
||||
string_error_login :: L.LoginParsingError -> String
|
||||
string_error_login = case _ of
|
||||
|
@ -92,6 +92,9 @@ data Action
|
||||
-- | Change the displayed tab.
|
||||
| ChangeTab Tab
|
||||
|
||||
-- | TODO: undocumented yet.
|
||||
| CloseErrorStuff
|
||||
|
||||
-- | There are different tabs in the administration page.
|
||||
-- | For example, users can be searched (`authd`) and a list is provided.
|
||||
data Tab = Auth | ILostMyPassword | Recovery
|
||||
@ -135,7 +138,8 @@ render { current_tab, authenticationForm, passwordRecoveryForm, newPasswordForm,
|
||||
Bulma.section_small
|
||||
[ fancy_tab_bar
|
||||
, if A.length errors > 0
|
||||
then HH.div_ [ Bulma.box [ HH.text (A.fold $ map show_error errors) ] ]
|
||||
-- then HH.div_ [ Bulma.box [ HH.text (A.fold $ map show_error errors) ] ]
|
||||
then HH.div_ [ Bulma.box [Bulma.notification_danger (A.fold $ map show_error errors) CloseErrorStuff]]
|
||||
else HH.div_ []
|
||||
, case current_tab of
|
||||
Auth -> Bulma.box auth_form
|
||||
@ -154,14 +158,15 @@ render { current_tab, authenticationForm, passwordRecoveryForm, newPasswordForm,
|
||||
|
||||
show_error :: Error -> String
|
||||
show_error = case _ of
|
||||
Login arr -> "Error with the Login: " <> (A.fold $ map show_error_login arr)
|
||||
Email arr -> "Error with the Email: " <> (A.fold $ map show_error_email arr)
|
||||
Password arr -> "Error with the Password: " <> (A.fold $ map show_error_password arr)
|
||||
Login arr -> "Error with the login: " <> (A.fold $ map show_error_login arr)
|
||||
Email arr -> "Error with the email: " <> (A.fold $ map show_error_email arr)
|
||||
Password arr -> "Error with the password: " <> (A.fold $ map show_error_password arr)
|
||||
|
||||
show_error_login :: L.Error -> String
|
||||
show_error_login = case _ of
|
||||
L.ParsingError {error, position} ->
|
||||
"position " <> show position <> " " <> maybe "" string_error_login error
|
||||
-- L.ParsingError {error, position} ->
|
||||
-- "position " <> show position <> " " <> maybe "" string_error_login error
|
||||
L.ParsingError {error} -> maybe "" string_error_login error
|
||||
|
||||
string_error_login :: L.LoginParsingError -> String
|
||||
string_error_login = case _ of
|
||||
@ -172,8 +177,9 @@ render { current_tab, authenticationForm, passwordRecoveryForm, newPasswordForm,
|
||||
<> " (currently: " <> show n <> ")"
|
||||
show_error_email :: E.Error -> String
|
||||
show_error_email = case _ of
|
||||
E.ParsingError {error, position} ->
|
||||
"position " <> show position <> " " <> maybe "" string_error_email error
|
||||
-- E.ParsingError {error, position} ->
|
||||
-- "position " <> show position <> " " <> maybe "" string_error_email error
|
||||
E.ParsingError {error} -> maybe "" string_error_email error
|
||||
|
||||
string_error_email :: E.EmailParsingError -> String
|
||||
string_error_email = case _ of
|
||||
@ -357,6 +363,9 @@ handleAction = case _ of
|
||||
H.liftEffect $ Storage.setItem "current-auth-tab" "Recovery" sessionstorage
|
||||
H.modify_ _ { current_tab = current_tab }
|
||||
|
||||
CloseErrorStuff -> do
|
||||
H.modify_ _ { errors = [] }
|
||||
|
||||
handleQuery :: forall a m. MonadAff m => Query a -> H.HalogenM State Action () Output m (Maybe a)
|
||||
handleQuery = case _ of
|
||||
-- For now, no message actually needs to be handled here.
|
||||
|
@ -141,8 +141,9 @@ show_error = case _ of
|
||||
|
||||
show_error_login :: L.Error -> String
|
||||
show_error_login = case _ of
|
||||
L.ParsingError {error, position} ->
|
||||
"position " <> show position <> " " <> maybe "" string_error_login error
|
||||
-- L.ParsingError {error, position} ->
|
||||
-- "position " <> show position <> " " <> maybe "" string_error_login error
|
||||
L.ParsingError {error} -> maybe "" string_error_login error
|
||||
|
||||
string_error_login :: L.LoginParsingError -> String
|
||||
string_error_login = case _ of
|
||||
@ -154,8 +155,9 @@ string_error_login = case _ of
|
||||
|
||||
show_error_token :: T.Error -> String
|
||||
show_error_token = case _ of
|
||||
T.ParsingError {error, position} ->
|
||||
"position " <> show position <> " " <> maybe "" string_error_token error
|
||||
-- T.ParsingError {error, position} ->
|
||||
-- "position " <> show position <> " " <> maybe "" string_error_token error
|
||||
T.ParsingError {error} -> maybe "" string_error_token error
|
||||
|
||||
string_error_token :: T.TokenParsingError -> String
|
||||
string_error_token = case _ of
|
||||
|
@ -203,14 +203,15 @@ handleAction = case _ of
|
||||
where
|
||||
show_error_password :: P.Error -> String
|
||||
show_error_password = case _ of
|
||||
P.ParsingError {error, position} ->
|
||||
"position " <> show position <> " " <> maybe "" string_error_password error
|
||||
-- P.ParsingError {error, position} ->
|
||||
-- "position " <> show position <> " " <> maybe "" string_error_password error
|
||||
P.ParsingError {error} -> maybe "" string_error_password error
|
||||
|
||||
string_error_password :: P.PasswordParsingError -> String
|
||||
string_error_password = case _ of
|
||||
P.CannotParse -> "cannot parse the password"
|
||||
P.CannotEntirelyParse -> "cannot entirely parse the password"
|
||||
P.Size min max n -> "password size should be between "
|
||||
P.CannotParse -> "Cannot parse the password"
|
||||
P.CannotEntirelyParse -> "Cannot entirely parse the password"
|
||||
P.Size min max n -> "Password size should be between "
|
||||
<> show min <> " and " <> show max
|
||||
<> " (currently: " <> show n <> ")"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user