Password recovery: now tries the password before sending the request.
This commit is contained in:
parent
044578a501
commit
55f39c070c
@ -341,7 +341,6 @@ handleAction = case _ of
|
|||||||
_ -> do H.modify_ _ { errors = [] }
|
_ -> do H.modify_ _ { errors = [] }
|
||||||
H.raise $ AskPasswordRecovery (Left email)
|
H.raise $ AskPasswordRecovery (Left email)
|
||||||
|
|
||||||
-- TODO: verify the login?
|
|
||||||
NewPasswordAttempt ev -> do
|
NewPasswordAttempt ev -> do
|
||||||
H.liftEffect $ Event.preventDefault ev
|
H.liftEffect $ Event.preventDefault ev
|
||||||
|
|
||||||
@ -349,13 +348,15 @@ handleAction = case _ of
|
|||||||
let { login, token, password, confirmation} = newPasswordForm
|
let { login, token, password, confirmation} = newPasswordForm
|
||||||
|
|
||||||
if A.any (_ == "") [ login, token, password, confirmation ]
|
if A.any (_ == "") [ login, token, password, confirmation ]
|
||||||
then H.raise $ Log $ ErrorLog "All entries are required!"
|
then H.raise $ Log $ ErrorLog "All entries are required"
|
||||||
else if password == confirmation
|
else if password == confirmation
|
||||||
then case L.login login of
|
then case L.login login, P.password password of
|
||||||
Left errors -> H.modify_ _ { errors = [ Login errors ] }
|
Left errors, _ -> H.modify_ _ { errors = [ Login errors ] }
|
||||||
Right _ -> do H.modify_ _ { errors = [] }
|
_, Left errors -> H.modify_ _ { errors = [ Password errors ] }
|
||||||
H.raise $ PasswordRecovery login token password
|
_, _ -> do H.modify_ _ { errors = [] }
|
||||||
else H.raise $ Log $ UnableToSend "Confirmation differs from password!"
|
H.raise $ Log $ SystemLog $ "Sending a new password"
|
||||||
|
H.raise $ PasswordRecovery login token password
|
||||||
|
else H.raise $ Log $ UnableToSend "Confirmation differs from password"
|
||||||
|
|
||||||
ChangeTab current_tab -> do
|
ChangeTab current_tab -> do
|
||||||
-- Store the current tab we are on and restore it when we reload.
|
-- Store the current tab we are on and restore it when we reload.
|
||||||
|
Loading…
Reference in New Issue
Block a user