Add a page for logging out of Overleaf (#30945)

GitOrigin-RevId: 88a9bfd698bcd6cf03f3081e807def6b9b846e86
This commit is contained in:
jmescuderowritefull
2026-02-04 10:09:34 +01:00
committed by Copybot
parent eeecf3d71a
commit 9eaacdf5d5
4 changed files with 36 additions and 0 deletions

View File

@@ -191,6 +191,14 @@ async function accountSuspended(req, res) {
})
}
async function logout(req, res) {
const isLoggedIn = SessionManager.isUserLoggedIn(req.session)
if (!isLoggedIn) {
return res.redirect('/')
}
res.render('user/logout')
}
async function reconfirmAccountPage(req, res) {
const pageData = {
reconfirm_email: req.session.reconfirm_email,
@@ -234,6 +242,7 @@ async function emailPreferencesPage(req, res) {
const UserPagesController = {
accountSuspended: expressify(accountSuspended),
logout: expressify(logout),
registerPage(req, res) {
const sharedProjectData = req.session.sharedProjectData || {}

View File

@@ -258,6 +258,7 @@ async function initialize(webRouter, privateApiRouter, publicApiRouter) {
'/read-only/one-time-login'
)
webRouter.get('/logout', UserPagesController.logout)
webRouter.post('/logout', UserController.logout)
webRouter.get('/restricted', AuthorizationMiddleware.restricted)

View File

@@ -0,0 +1,24 @@
extends ../layout-marketing
block vars
- var suppressNavbar = true
- var suppressFooter = true
- var suppressPugCookieBanner = true
- metadata = {title: translate('log_out_of_overleaf')}
block content
main#main-content.content.content-alt.full-height
.container.full-height
.row
.col-xl-6.offset-xl-3
.card
.card-body
.page-header
h1 #{translate("log_out_of_overleaf")}
form(name='logoutForm' data-ol-async-form action='/logout' method='POST')
input(name='_csrf' type='hidden' value=csrfToken)
p #{translate("log_out_of_overleaf_confirmation")}
.d-flex.justify-content-between.flex-row
button.btn-primary.btn(type='submit' data-ol-disabled-inflight)
span #{translate("log_out")}
a.btn-secondary.btn(href='/') #{translate("cancel")}

View File

@@ -1346,6 +1346,8 @@
"log_out": "Log Out",
"log_out_from": "Log out from __email__",
"log_out_lowercase_dot": "Log out.",
"log_out_of_overleaf": "Log out of __appName__",
"log_out_of_overleaf_confirmation": "Are you sure you want to log out of __appName__?",
"log_viewer_error": "There was a problem displaying this projects compilation errors and logs.",
"logged_in_with_email": "You are currently logged in to <b>__appName__</b> with the email <b>__email__</b>.",
"logging_in": "Logging in",