FIX: Bring back the login-required page for fullpage login (#29316)

This commit is contained in:
Jan Cernik 2024-10-22 10:05:23 -03:00 committed by GitHub
parent ad39688afa
commit 4254a686d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 21 additions and 13 deletions

View File

@ -35,6 +35,7 @@ export default class LoginPageController extends Controller {
@tracked loggingIn = false;
@tracked loggedIn = false;
@tracked showLoginButtons = true;
@tracked showLogin = false;
@tracked showSecondFactor = false;
@tracked loginPassword = "";
@tracked loginName = "";
@ -115,6 +116,11 @@ export default class LoginPageController extends Controller {
return getURL("/u/admin-login");
}
@action
showLoginPage() {
this.showLogin = true;
}
@action
async passkeyLogin(mediation = "optional") {
try {

View File

@ -21,9 +21,7 @@ export default class LoginRoute extends DiscourseRoute {
}
model() {
if (!this.siteSettings.experimental_full_page_login) {
return StaticPage.find("login");
}
return StaticPage.find("login");
}
setupController(controller) {

View File

@ -1,4 +1,9 @@
{{#if this.siteSettings.experimental_full_page_login}}
{{#if
(and
this.siteSettings.experimental_full_page_login
(or this.showLogin (not this.siteSettings.login_required))
)
}}
{{hide-application-header-buttons "search" "login" "signup" "menu"}}
{{hide-application-sidebar}}
@ -163,7 +168,11 @@
{{/if}}
<DButton
@action={{route-action "showLogin"}}
@action={{if
this.siteSettings.experimental_full_page_login
this.showLoginPage
(route-action "showLogin")
}}
@icon="user"
@label="log_in"
class="btn-primary login-button"

View File

@ -115,14 +115,9 @@ shared_examples "login scenarios" do |login_page_object|
it "cannot browse annonymously" do
visit "/"
if SiteSetting.experimental_full_page_login
expect(page).to have_css(".login-fullpage")
else
expect(page).to have_css(".login-welcome")
expect(page).to have_css(".site-logo")
find(".login-welcome .login-button").click
end
expect(page).to have_css(".login-welcome")
expect(page).to have_css(".site-logo")
find(".login-welcome .login-button").click
EmailToken.confirm(Fabricate(:email_token, user: user).token)
login_form.fill(username: "john", password: "supersecurepassword").click_login