Remove password after login, if necessary

pull/25/head
Bram 2024-05-30 10:52:48 +02:00
parent e8c0df004e
commit b465ad1f47
2 changed files with 9 additions and 0 deletions

View File

@ -190,6 +190,7 @@ loginWithUsernameAndPasswordV1 { username, password } =
, refresh = out.refreshToken
, value = out.accessToken
}
, E.RemovePasswordIfNecessary
, out.user
|> Maybe.map (V.SetUser >> E.ContentUpdate)
|> E.Optional

View File

@ -78,6 +78,7 @@ type EnvelopeUpdate a
| More (List (EnvelopeUpdate a))
| Optional (Maybe (EnvelopeUpdate a))
| RemoveAccessToken String
| RemovePasswordIfNecessary
| SetAccessToken AccessToken
| SetBaseUrl String
| SetDeviceId String
@ -311,6 +312,13 @@ update updateContent eu ({ context } as data) =
RemoveAccessToken token ->
{ data | context = { context | accessTokens = Hashdict.removeKey token context.accessTokens } }
RemovePasswordIfNecessary ->
if data.settings.removePasswordOnLogin then
{ data | context = { context | password = Nothing } }
else
data
SetAccessToken a ->
{ data | context = { context | accessTokens = Hashdict.insert a context.accessTokens } }