mirror of
https://github.com/vector-im/element-android.git
synced 2024-11-15 01:35:07 +08:00
passing the logout devices parameters to the account/password endpoint
This commit is contained in:
parent
c10254dbfa
commit
f21e30f7c7
@ -66,7 +66,7 @@ interface LoginWizard {
|
||||
* [resetPasswordMailConfirmed] is successfully called.
|
||||
*
|
||||
* @param email an email previously associated to the account the user wants the password to be reset.
|
||||
* @return a [ResetCapabilities] if the reset is successful
|
||||
* @return a [ResetCapabilities] if the reset is successful.
|
||||
*/
|
||||
suspend fun resetPassword(email: String): ResetCapabilities
|
||||
|
||||
@ -74,7 +74,10 @@ interface LoginWizard {
|
||||
* Confirm the new password, once the user has checked their email
|
||||
* When this method succeed, tha account password will be effectively modified.
|
||||
*
|
||||
* @param newPassword the desired new password
|
||||
* @param newPassword the desired new password.
|
||||
* @param logoutAllDevices when true, all devices will be logged out. False values will only be taken into account
|
||||
* if [ResetCapabilities.supportsLogoutAllDevices] is supported.
|
||||
* When [ResetCapabilities.supportsLogoutAllDevices] is false the default behaviour is to logout all devices.
|
||||
*/
|
||||
suspend fun resetPasswordMailConfirmed(newPassword: String)
|
||||
suspend fun resetPasswordMailConfirmed(newPassword: String, logoutAllDevices: Boolean = true)
|
||||
}
|
||||
|
@ -121,7 +121,6 @@ internal class DefaultLoginWizard(
|
||||
pendingSessionData = pendingSessionData.copy(resetPasswordData = ResetPasswordData(result))
|
||||
.also { pendingSessionStore.savePendingSessionData(it) }
|
||||
|
||||
|
||||
val versions = executeRequest(null) {
|
||||
authAPI.versions()
|
||||
}
|
||||
@ -129,12 +128,13 @@ internal class DefaultLoginWizard(
|
||||
return ResetCapabilities(supportsLogoutAllDevices = versions.doesServerSupportLogoutDevices())
|
||||
}
|
||||
|
||||
override suspend fun resetPasswordMailConfirmed(newPassword: String) {
|
||||
override suspend fun resetPasswordMailConfirmed(newPassword: String, logoutAllDevices: Boolean) {
|
||||
val resetPasswordData = pendingSessionData.resetPasswordData ?: throw IllegalStateException("Developer error - Must call resetPassword first")
|
||||
val param = ResetPasswordMailConfirmed.create(
|
||||
pendingSessionData.clientSecret,
|
||||
resetPasswordData.addThreePidRegistrationResponse.sid,
|
||||
newPassword
|
||||
newPassword,
|
||||
logoutAllDevices
|
||||
)
|
||||
|
||||
executeRequest(null) {
|
||||
|
@ -30,13 +30,17 @@ internal data class ResetPasswordMailConfirmed(
|
||||
|
||||
// the new password
|
||||
@Json(name = "new_password")
|
||||
val newPassword: String? = null
|
||||
val newPassword: String? = null,
|
||||
|
||||
@Json(name = "logout_devices")
|
||||
val logoutDevices: Boolean? = null
|
||||
) {
|
||||
companion object {
|
||||
fun create(clientSecret: String, sid: String, newPassword: String): ResetPasswordMailConfirmed {
|
||||
fun create(clientSecret: String, sid: String, newPassword: String, logoutDevices: Boolean?): ResetPasswordMailConfirmed {
|
||||
return ResetPasswordMailConfirmed(
|
||||
auth = AuthParams.createForResetPassword(clientSecret, sid),
|
||||
newPassword = newPassword
|
||||
newPassword = newPassword,
|
||||
logoutDevices = logoutDevices
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user