OIDC redirect to the web page to delete a session (legacy session manager) #8616
This commit is contained in:
parent
8f6edba403
commit
12395e9b04
|
@ -50,4 +50,6 @@ sealed class DevicesViewEvents : VectorViewEvents {
|
|||
data class ShowManuallyVerify(val cryptoDeviceInfo: CryptoDeviceInfo) : DevicesViewEvents()
|
||||
|
||||
object PromptResetSecrets : DevicesViewEvents()
|
||||
|
||||
data class OpenBrowser(val url: String) : DevicesViewEvents()
|
||||
}
|
||||
|
|
|
@ -346,6 +346,20 @@ class DevicesViewModel @AssistedInject constructor(
|
|||
private fun handleDelete(action: DevicesAction.Delete) {
|
||||
val deviceId = action.deviceId
|
||||
|
||||
val accountManagementUrl = session.homeServerCapabilitiesService().getHomeServerCapabilities().externalAccountManagementUrl
|
||||
if (accountManagementUrl != null) {
|
||||
// Open external browser to delete this session
|
||||
_viewEvents.post(
|
||||
DevicesViewEvents.OpenBrowser(
|
||||
url = accountManagementUrl.removeSuffix("/") + "?action=session_end&device_id=$deviceId"
|
||||
)
|
||||
)
|
||||
} else {
|
||||
doDelete(deviceId)
|
||||
}
|
||||
}
|
||||
|
||||
private fun doDelete(deviceId: String) {
|
||||
setState {
|
||||
copy(
|
||||
request = Loading()
|
||||
|
|
|
@ -35,6 +35,7 @@ import im.vector.app.core.extensions.cleanup
|
|||
import im.vector.app.core.extensions.configureWith
|
||||
import im.vector.app.core.extensions.registerStartForActivityResult
|
||||
import im.vector.app.core.platform.VectorBaseFragment
|
||||
import im.vector.app.core.utils.openUrlInChromeCustomTab
|
||||
import im.vector.app.databinding.DialogBaseEditTextBinding
|
||||
import im.vector.app.databinding.FragmentGenericRecyclerBinding
|
||||
import im.vector.app.features.auth.ReAuthActivity
|
||||
|
@ -95,6 +96,9 @@ class VectorSettingsDevicesFragment :
|
|||
is DevicesViewEvents.PromptResetSecrets -> {
|
||||
navigator.open4SSetup(requireActivity(), SetupMode.PASSPHRASE_AND_NEEDED_SECRETS_RESET)
|
||||
}
|
||||
is DevicesViewEvents.OpenBrowser -> {
|
||||
openUrlInChromeCustomTab(requireContext(), null, it.url)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue