-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
login: Warn before logging into multiple hosts #20861
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -355,8 +355,16 @@ import "./login.scss"; | |
} | ||
} | ||
|
||
if (cur_machine && !environment.page.allow_multihost) | ||
redirect_to_current_machine(); | ||
if (cur_machine) { | ||
if (!environment.page.allow_multihost) | ||
redirect_to_current_machine(); | ||
else { | ||
id("multihost-message").textContent = format(_("You are already connected to '$0' in this browser session. Connecting to other hosts will allow them to execute arbitrary code on each other. Please be careful."), | ||
cur_machine == "." ? "localhost" : cur_machine); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This added line is not executed by any test. |
||
id("multihost-get-me-there").addEventListener("click", redirect_to_current_machine); | ||
show('#multihost-warning'); | ||
} | ||
} | ||
} | ||
|
||
function boot() { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -354,14 +354,14 @@ label.checkbox { | |
display: none; | ||
} | ||
|
||
.login-pf #banner { | ||
.login-pf #banner, .login-pf #multihost-warning { | ||
margin-block: 1rem 0.5rem; | ||
margin-inline: 0; | ||
grid-area: banner; | ||
inline-size: 100%; | ||
} | ||
|
||
#banner-message { | ||
#banner-message, #multihost-message { | ||
Comment on lines
-357
to
+364
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We really shouldn't target IDs in the CSS. We already do, I know, but we shouldn't add more. (The selectors should be targeting classes.) We especially should not have IDs nested under other selectors like this. Ideally, we'd fix the older parts by changing those too. Anyway, I'm not expecting you to have to fix this, just pointing out that it's bad form. We're already doing bad stuff anyway in the file, so it's not a huge deal. But it's important for new code and we should (at some point) clean up instances where IDs are used in CSS. It's important everyone on the team understands this, as using IDs leads to other bad things, like CSS not working as expected, resulting in
(Note: We shouldn't use an attribute selector as it suggests, but actually fix the HTML.) IDs are great and to be used in JavaScript for quick specific element selecting (as there's only one unique instance of an ID allowed on a document), of course. But it's bad for CSS. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (BTW: I'm not blocking on this in this PR or nitpicking, just pointing out something that would have really bad side effects, especially elsewhere in Cockpit.) |
||
white-space: pre-wrap; | ||
max-block-size: 12em; | ||
overflow: auto; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This added line is not executed by any test.