Add RemovePasswordOnLogin feature
parent
b465ad1f47
commit
994c99af15
File diff suppressed because one or more lines are too long
|
@ -232,6 +232,7 @@ loginWithUsernameAndPasswordV2 { deviceId, initialDeviceDisplayName, username, p
|
|||
, refresh = Nothing
|
||||
, value = out.accessToken
|
||||
}
|
||||
, E.RemovePasswordIfNecessary
|
||||
, out.user
|
||||
|> Maybe.map (V.SetUser >> E.ContentUpdate)
|
||||
|> E.Optional
|
||||
|
@ -283,6 +284,7 @@ loginWithUsernameAndPasswordV3 { deviceId, initialDeviceDisplayName, username, p
|
|||
, refresh = Nothing
|
||||
, value = out.accessToken
|
||||
}
|
||||
, E.RemovePasswordIfNecessary
|
||||
, out.user
|
||||
|> Maybe.map (V.SetUser >> E.ContentUpdate)
|
||||
|> E.Optional
|
||||
|
@ -334,6 +336,7 @@ loginWithUsernameAndPasswordV4 { deviceId, initialDeviceDisplayName, username, p
|
|||
, refresh = Nothing
|
||||
, value = out.accessToken
|
||||
}
|
||||
, E.RemovePasswordIfNecessary
|
||||
, out.user
|
||||
|> Maybe.map (V.SetUser >> E.ContentUpdate)
|
||||
|> E.Optional
|
||||
|
@ -389,6 +392,7 @@ loginWithUsernameAndPasswordV5 { deviceId, initialDeviceDisplayName, username, p
|
|||
, refresh = Nothing
|
||||
, value = out.accessToken
|
||||
}
|
||||
, E.RemovePasswordIfNecessary
|
||||
, out.user
|
||||
|> Maybe.map (V.SetUser >> E.ContentUpdate)
|
||||
|> E.Optional
|
||||
|
@ -445,6 +449,7 @@ loginWithUsernameAndPasswordV6 { deviceId, enableRefreshToken, initialDeviceDisp
|
|||
, refresh = out.refreshToken
|
||||
, value = out.accessToken
|
||||
}
|
||||
, E.RemovePasswordIfNecessary
|
||||
, out.user
|
||||
|> Maybe.map (V.SetUser >> E.ContentUpdate)
|
||||
|> E.Optional
|
||||
|
@ -501,6 +506,7 @@ loginWithUsernameAndPasswordV7 { deviceId, enableRefreshToken, initialDeviceDisp
|
|||
, refresh = out.refreshToken
|
||||
, value = out.accessToken
|
||||
}
|
||||
, E.RemovePasswordIfNecessary
|
||||
, E.ContentUpdate (V.SetUser out.user)
|
||||
, out.wellKnown
|
||||
|> Maybe.map (.homeserver >> .baseUrl)
|
||||
|
|
|
@ -57,6 +57,9 @@ type alias VaultUpdate =
|
|||
Types.VaultUpdate
|
||||
|
||||
|
||||
{-| Adds a custom access token to the Vault. This can be done if no password is
|
||||
provided or known.
|
||||
-}
|
||||
addAccessToken : String -> Vault -> Vault
|
||||
addAccessToken token (Vault vault) =
|
||||
Envelope.mapContext (\c -> { c | suggestedAccessToken = Just token }) vault
|
||||
|
@ -74,16 +77,18 @@ addAccessToken token (Vault vault) =
|
|||
|
||||
-}
|
||||
fromUserId : String -> Maybe Vault
|
||||
fromUserId =
|
||||
User.fromString
|
||||
>> Maybe.map
|
||||
fromUserId uid =
|
||||
uid
|
||||
|> User.fromString
|
||||
|> Maybe.map
|
||||
(\u ->
|
||||
Envelope.init
|
||||
{ serverName = "https://" ++ User.domain u
|
||||
, content = Internal.init u
|
||||
, content = Internal.init (Just u)
|
||||
}
|
||||
|> Envelope.mapContext (\c -> { c | username = Just uid })
|
||||
)
|
||||
>> Maybe.map Vault
|
||||
|> Maybe.map Vault
|
||||
|
||||
|
||||
{-| Send a message event to a room.
|
||||
|
|
Loading…
Reference in New Issue