diff --git a/src/Internal/Api/LoginWithUsernameAndPassword/Api.elm b/src/Internal/Api/LoginWithUsernameAndPassword/Api.elm index a839d2c..5ae8f29 100644 --- a/src/Internal/Api/LoginWithUsernameAndPassword/Api.elm +++ b/src/Internal/Api/LoginWithUsernameAndPassword/Api.elm @@ -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 diff --git a/src/Internal/Values/Envelope.elm b/src/Internal/Values/Envelope.elm index 9ecbef1..7823e62 100644 --- a/src/Internal/Values/Envelope.elm +++ b/src/Internal/Values/Envelope.elm @@ -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 } }