Skip to content

Commit 12395e9

Browse files
committed
OIDC redirect to the web page to delete a session (legacy session manager) #8616
1 parent 8f6edba commit 12395e9

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

vector/src/main/java/im/vector/app/features/settings/devices/DevicesViewEvents.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,6 @@ sealed class DevicesViewEvents : VectorViewEvents {
5050
data class ShowManuallyVerify(val cryptoDeviceInfo: CryptoDeviceInfo) : DevicesViewEvents()
5151

5252
object PromptResetSecrets : DevicesViewEvents()
53+
54+
data class OpenBrowser(val url: String) : DevicesViewEvents()
5355
}

vector/src/main/java/im/vector/app/features/settings/devices/DevicesViewModel.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,20 @@ class DevicesViewModel @AssistedInject constructor(
346346
private fun handleDelete(action: DevicesAction.Delete) {
347347
val deviceId = action.deviceId
348348

349+
val accountManagementUrl = session.homeServerCapabilitiesService().getHomeServerCapabilities().externalAccountManagementUrl
350+
if (accountManagementUrl != null) {
351+
// Open external browser to delete this session
352+
_viewEvents.post(
353+
DevicesViewEvents.OpenBrowser(
354+
url = accountManagementUrl.removeSuffix("/") + "?action=session_end&device_id=$deviceId"
355+
)
356+
)
357+
} else {
358+
doDelete(deviceId)
359+
}
360+
}
361+
362+
private fun doDelete(deviceId: String) {
349363
setState {
350364
copy(
351365
request = Loading()

vector/src/main/java/im/vector/app/features/settings/devices/VectorSettingsDevicesFragment.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import im.vector.app.core.extensions.cleanup
3535
import im.vector.app.core.extensions.configureWith
3636
import im.vector.app.core.extensions.registerStartForActivityResult
3737
import im.vector.app.core.platform.VectorBaseFragment
38+
import im.vector.app.core.utils.openUrlInChromeCustomTab
3839
import im.vector.app.databinding.DialogBaseEditTextBinding
3940
import im.vector.app.databinding.FragmentGenericRecyclerBinding
4041
import im.vector.app.features.auth.ReAuthActivity
@@ -95,6 +96,9 @@ class VectorSettingsDevicesFragment :
9596
is DevicesViewEvents.PromptResetSecrets -> {
9697
navigator.open4SSetup(requireActivity(), SetupMode.PASSPHRASE_AND_NEEDED_SECRETS_RESET)
9798
}
99+
is DevicesViewEvents.OpenBrowser -> {
100+
openUrlInChromeCustomTab(requireContext(), null, it.url)
101+
}
98102
}
99103
}
100104
}

0 commit comments

Comments
 (0)