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
|
, refresh = Nothing
|
||||||
, value = out.accessToken
|
, value = out.accessToken
|
||||||
}
|
}
|
||||||
|
, E.RemovePasswordIfNecessary
|
||||||
, out.user
|
, out.user
|
||||||
|> Maybe.map (V.SetUser >> E.ContentUpdate)
|
|> Maybe.map (V.SetUser >> E.ContentUpdate)
|
||||||
|> E.Optional
|
|> E.Optional
|
||||||
|
@ -283,6 +284,7 @@ loginWithUsernameAndPasswordV3 { deviceId, initialDeviceDisplayName, username, p
|
||||||
, refresh = Nothing
|
, refresh = Nothing
|
||||||
, value = out.accessToken
|
, value = out.accessToken
|
||||||
}
|
}
|
||||||
|
, E.RemovePasswordIfNecessary
|
||||||
, out.user
|
, out.user
|
||||||
|> Maybe.map (V.SetUser >> E.ContentUpdate)
|
|> Maybe.map (V.SetUser >> E.ContentUpdate)
|
||||||
|> E.Optional
|
|> E.Optional
|
||||||
|
@ -334,6 +336,7 @@ loginWithUsernameAndPasswordV4 { deviceId, initialDeviceDisplayName, username, p
|
||||||
, refresh = Nothing
|
, refresh = Nothing
|
||||||
, value = out.accessToken
|
, value = out.accessToken
|
||||||
}
|
}
|
||||||
|
, E.RemovePasswordIfNecessary
|
||||||
, out.user
|
, out.user
|
||||||
|> Maybe.map (V.SetUser >> E.ContentUpdate)
|
|> Maybe.map (V.SetUser >> E.ContentUpdate)
|
||||||
|> E.Optional
|
|> E.Optional
|
||||||
|
@ -389,6 +392,7 @@ loginWithUsernameAndPasswordV5 { deviceId, initialDeviceDisplayName, username, p
|
||||||
, refresh = Nothing
|
, refresh = Nothing
|
||||||
, value = out.accessToken
|
, value = out.accessToken
|
||||||
}
|
}
|
||||||
|
, E.RemovePasswordIfNecessary
|
||||||
, out.user
|
, out.user
|
||||||
|> Maybe.map (V.SetUser >> E.ContentUpdate)
|
|> Maybe.map (V.SetUser >> E.ContentUpdate)
|
||||||
|> E.Optional
|
|> E.Optional
|
||||||
|
@ -445,6 +449,7 @@ loginWithUsernameAndPasswordV6 { deviceId, enableRefreshToken, initialDeviceDisp
|
||||||
, refresh = out.refreshToken
|
, refresh = out.refreshToken
|
||||||
, value = out.accessToken
|
, value = out.accessToken
|
||||||
}
|
}
|
||||||
|
, E.RemovePasswordIfNecessary
|
||||||
, out.user
|
, out.user
|
||||||
|> Maybe.map (V.SetUser >> E.ContentUpdate)
|
|> Maybe.map (V.SetUser >> E.ContentUpdate)
|
||||||
|> E.Optional
|
|> E.Optional
|
||||||
|
@ -501,6 +506,7 @@ loginWithUsernameAndPasswordV7 { deviceId, enableRefreshToken, initialDeviceDisp
|
||||||
, refresh = out.refreshToken
|
, refresh = out.refreshToken
|
||||||
, value = out.accessToken
|
, value = out.accessToken
|
||||||
}
|
}
|
||||||
|
, E.RemovePasswordIfNecessary
|
||||||
, E.ContentUpdate (V.SetUser out.user)
|
, E.ContentUpdate (V.SetUser out.user)
|
||||||
, out.wellKnown
|
, out.wellKnown
|
||||||
|> Maybe.map (.homeserver >> .baseUrl)
|
|> Maybe.map (.homeserver >> .baseUrl)
|
||||||
|
|
|
@ -57,6 +57,9 @@ type alias VaultUpdate =
|
||||||
Types.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 : String -> Vault -> Vault
|
||||||
addAccessToken token (Vault vault) =
|
addAccessToken token (Vault vault) =
|
||||||
Envelope.mapContext (\c -> { c | suggestedAccessToken = Just token }) vault
|
Envelope.mapContext (\c -> { c | suggestedAccessToken = Just token }) vault
|
||||||
|
@ -74,16 +77,18 @@ addAccessToken token (Vault vault) =
|
||||||
|
|
||||||
-}
|
-}
|
||||||
fromUserId : String -> Maybe Vault
|
fromUserId : String -> Maybe Vault
|
||||||
fromUserId =
|
fromUserId uid =
|
||||||
User.fromString
|
uid
|
||||||
>> Maybe.map
|
|> User.fromString
|
||||||
|
|> Maybe.map
|
||||||
(\u ->
|
(\u ->
|
||||||
Envelope.init
|
Envelope.init
|
||||||
{ serverName = "https://" ++ User.domain u
|
{ 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.
|
{-| Send a message event to a room.
|
||||||
|
|
Loading…
Reference in New Issue