Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix email_verified_code usage #4252

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion assets/scripts/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,14 @@
const data = new URLSearchParams()
data.append('passphrase', pass)
data.append('trusted-device-token', trustedTokenInput.value)
data.append('email_verified_code', emailVerifiedCodeInput.value)
data.append('long-run-session', longRun)
data.append('redirect', redirect)
data.append('csrf_token', csrfTokenInput.value)

if (emailVerifiedCodeInput) {
data.append('email_verified_code', emailVerifiedCodeInput.value)
}

// For the /auth/authorize/move && /auth/confirm pages
if (stateInput) {
data.append('state', stateInput.value)
Expand Down
12 changes: 10 additions & 2 deletions web/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,14 @@ func renderLoginForm(c echo.Context, i *instance.Instance, code int, credsErrors
iterations = settings.PassphraseKdfIterations
}

// When we have an email_verified_code, we need to ask the user their
// password, not send them an email with a magic link
emailVerifiedCode := c.QueryParam("email_verified_code")
magicLink := i.MagicLink
if emailVerifiedCode != "" {
magicLink = false
}

return c.Render(code, "login.html", echo.Map{
"TemplateTitle": i.TemplateTitle(),
"Domain": i.ContextualDomain(),
Expand All @@ -220,8 +228,8 @@ func renderLoginForm(c echo.Context, i *instance.Instance, code int, credsErrors
"CredentialsError": credsErrors,
"Redirect": redirectStr,
"CSRF": c.Get("csrf"),
"EmailVerifiedCode": c.QueryParam("email_verified_code"),
"MagicLink": i.MagicLink,
"EmailVerifiedCode": emailVerifiedCode,
"MagicLink": magicLink,
"OAuth": hasOAuth,
"FranceConnect": hasFranceConnect,
})
Expand Down
44 changes: 22 additions & 22 deletions web/statik/statik.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading