mirror of
https://github.com/HeyPuter/puter.git
synced 2026-11-03 20:43:22 +00:00
fix(gui): stop disabling 2FA when the provider sign-in doesn't happen
For an account that signs in through a linked provider, turning 2FA off
opens the provider's sign-in popup. When the popup was closed or
blocked, the dialog showed why for a moment and then sent the request
anyway, whose refusal ("OIDC revalidation required") replaced the
reason. It now stops at the popup's error.
This commit is contained in:
1 parent
906ea0f7ee
commit
6b276a4823
1 file changed
+6
-3
@@ -122,9 +122,10 @@ async function UIWindowDisable2FA (options) {
|
||||
hint.text(REVALIDATE_POPUP_TEXT).show();
|
||||
try {
|
||||
await openRevalidatePopup(revalidateUrl);
|
||||
return true;
|
||||
} catch (e) {
|
||||
onError(e.message || 'Authentication failed');
|
||||
return;
|
||||
return false;
|
||||
} finally {
|
||||
hint.hide();
|
||||
}
|
||||
@@ -153,7 +154,9 @@ async function UIWindowDisable2FA (options) {
|
||||
}
|
||||
|
||||
if ( oidc_only && !revalidated && !password ) {
|
||||
await myOpenRevalidatePopup();
|
||||
// A popup closed or blocked says so; the request would only be
|
||||
// refused, and its message would replace that.
|
||||
if ( ! await myOpenRevalidatePopup() ) return;
|
||||
|
||||
const res = await doSubmit({ password: undefined });
|
||||
const data = await res.json().catch(() => ({}));
|
||||
@@ -178,7 +181,7 @@ async function UIWindowDisable2FA (options) {
|
||||
return;
|
||||
}
|
||||
if ( data.code === 'oidc_revalidation_required' && data.revalidate_url ) {
|
||||
await myOpenRevalidatePopup(data.revalidate_url);
|
||||
if ( ! await myOpenRevalidatePopup(data.revalidate_url) ) return;
|
||||
const r = await doSubmit({ password: undefined });
|
||||
if ( r.ok ) {
|
||||
onSuccess();
|
||||
|
||||
Reference in new issue
Block a user