Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 104c27f1 authored by Dhruv Puri's avatar Dhruv Puri
Browse files

fix(login): skip the loginflowv2 grant page

Hide the grant form via CSS and auto-submit it via custom-login.js, so
users don't see the orange Grant access button flash. The form already
carries the CSRF + state tokens needed.

Revert path: remove the #redirect-link visibility:hidden rule in
guest.css and the matching auto-submit block in custom-login.js.

Refs ecorp/b2b/apps/workspace#19
parent f9857263
Loading
Loading
Loading
Loading
+5 −9
Original line number Diff line number Diff line
@@ -1815,16 +1815,12 @@ a.legal {
    color: #ffffff;
}

/* Center the "Grant access" submit button on the loginflowv2 grant page.
   `#submit-wrapper` is a 260px-wide flex container; push it to the
   horizontal center with auto margins so it doesn't sit flush-left
   inside the picker-window. */
/* Skip the loginflowv2 grant page (per workspace#19 review): hide the form
   so the user doesn't see the orange "Grant access" button flash before
   custom-login.js auto-submits it. The form already carries the CSRF and
   state tokens. To revert, drop this rule and the matching JS block. */
#body-login .picker-window #redirect-link {
    text-align: center;
}
#body-login .picker-window #submit-wrapper {
    margin-left: auto !important;
    margin-right: auto !important;
    visibility: hidden;
}

@media(prefers-color-scheme: dark){
+8 −0
Original line number Diff line number Diff line
@@ -45,5 +45,13 @@ document.addEventListener('DOMContentLoaded', function() {
			loginWithDeviceLink.click();
		}
	}
	// Skip the loginflowv2 grant page (workspace#19): auto-submit the
	// existing CSRF + state-token form so the user never sees the orange
	// "Grant access" confirmation step. Paired with a `visibility: hidden`
	// on #redirect-link in guest.css. Revert by removing both blocks.
	if (/\/login\/v2\/grant(\b|$)/.test(window.location.pathname)) {
		var grantForm = document.querySelector('#redirect-link form');
		if (grantForm) { grantForm.submit(); }
	}
})