Skip to content

Commit

Permalink
Fix password change stylings for both color palettes
Browse files Browse the repository at this point in the history
  • Loading branch information
iliajie committed Jun 22, 2023
1 parent 165ff57 commit 3838bb6
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 61 deletions.
62 changes: 62 additions & 0 deletions authentic-init.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1474,6 +1474,68 @@ sub get_button_style
return ($keys, $class, $icon);
}

sub embed_login_head
{
my ($inline) = @_;
my $ext = (theme_debug_mode() ? 'src' : 'min');

# Define page title
my $title = $text{'session_header'};

print '<head>', "\n";
print ' <meta name="color-scheme" content="only light">', "\n";
embed_noscript();
print '<meta charset="utf-8">', "\n";
embed_favicon('login-page');
print '<title>', $title, '</title>', "\n";
print '<meta name="viewport" content="width=device-width, initial-scale=1.0">' . "\n";

if ($inline) {
my $file_contents = read_file_contents("$root_directory/$current_theme/unauthenticated/css/bundle.min.css");
print '<style>';
print $file_contents;
print '</style>';

if (theme_night_mode_login()) {
my $file_contents =
read_file_contents("$root_directory/$current_theme/unauthenticated/css/palettes/nightrider.min.css");
print '<style>';
print $file_contents;
print '</style>';
}
my $file_contents = read_file_contents("$root_directory/$current_theme/unauthenticated/css/fonts-roboto.min.css");
print '<style>';
print $file_contents;
print '</style>';

} else {
print '<link href="' . $theme_webprefix .
'/unauthenticated/css/bundle.min.css?' . theme_version('timestamped') . '" rel="stylesheet">' . "\n";

print
'<script>document.addEventListener("DOMContentLoaded", function(event) {var a=document.querySelectorAll(\'input[type="password"]\');i=0;
for(length=a.length;i<length;i++){var b=document.createElement("span"),d=30<a[i].offsetHeight?1:0;b.classList.add("input_warning_caps");b.setAttribute("title","Caps Lock");d&&b.classList.add("large");a[i].classList.add("use_input_warning_caps");a[i].parentNode.insertBefore(b,a[i].nextSibling);a[i].addEventListener("blur",function(){this.nextSibling.classList.remove("visible")});a[i].addEventListener("keydown",function(c){"function"===typeof c.getModifierState&&((state=20===c.keyCode?!c.getModifierState("CapsLock"):
c.getModifierState("CapsLock"))?this.nextSibling.classList.add("visible"):this.nextSibling.classList.remove("visible"))})};});function spinner() {var x = document.querySelector(\'button i.fa-sign-in:not(.invisible)\') || document.querySelector(\'button i.fa-qrcode:not(.invisible)\'),s = \'<span class="cspinner_container"><span class="cspinner"><span class="cspinner-icon white small"></span></span></span>\';if(x){x.classList.add("invisible"); x.insertAdjacentHTML(\'afterend\', s);x.parentNode.classList.add("disabled");x.parentNode.disabled=true}}setTimeout(function(){if(navigator&&navigator.oscpu){var t=navigator.oscpu,i=document.querySelector("html"),e="data-platform";t.indexOf("Linux")>-1?i.setAttribute(e,"linux"):t.indexOf("Windows")>-1&&i.setAttribute(e,"windows")}});</script>';

embed_css_night_rider();
embed_css_fonts();
}

embed_background();
embed_styles();
embed_overlay_head();
if (get_env('script_name') =~ /password_change\.cgi$/) {
print '<script>';
print 'document.addEventListener("DOMContentLoaded", function() {';
my $palette = theme_night_mode_login() ? 'nightRider' : 'gainsboro';
print 'document.querySelector("html").setAttribute("data-bgs", "' . $palette . '");';
print 'document.querySelector("body").classList.add("container", "session_login");';
print '});';
print '</script>';
}
print '</head>', "\n";
}

sub theme_night_mode
{
if ($theme_config{'settings_force_night_mode'} eq '1') {
Expand Down
53 changes: 0 additions & 53 deletions authentic-lib.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1371,59 +1371,6 @@ sub head
print "Content-type: text/html\n\n";
}

sub embed_login_head
{
my ($inline) = @_;
my $ext = (theme_debug_mode() ? 'src' : 'min');

# Define page title
my $title = $text{'session_header'};

print '<head>', "\n";
print ' <meta name="color-scheme" content="only light">', "\n";
embed_noscript();
print '<meta charset="utf-8">', "\n";
embed_favicon('login-page');
print '<title>', $title, '</title>', "\n";
print '<meta name="viewport" content="width=device-width, initial-scale=1.0">' . "\n";

if ($inline) {
my $file_contents = read_file_contents("$root_directory/$current_theme/unauthenticated/css/bundle.min.css");
print '<style>';
print $file_contents;
print '</style>';

if (theme_night_mode_login()) {
my $file_contents =
read_file_contents("$root_directory/$current_theme/unauthenticated/css/palettes/nightrider.min.css");
print '<style>';
print $file_contents;
print '</style>';
}
my $file_contents = read_file_contents("$root_directory/$current_theme/unauthenticated/css/fonts-roboto.min.css");
print '<style>';
print $file_contents;
print '</style>';

} else {
print '<link href="' . $theme_webprefix .
'/unauthenticated/css/bundle.min.css?' . theme_version('timestamped') . '" rel="stylesheet">' . "\n";

print
'<script>document.addEventListener("DOMContentLoaded", function(event) {var a=document.querySelectorAll(\'input[type="password"]\');i=0;
for(length=a.length;i<length;i++){var b=document.createElement("span"),d=30<a[i].offsetHeight?1:0;b.classList.add("input_warning_caps");b.setAttribute("title","Caps Lock");d&&b.classList.add("large");a[i].classList.add("use_input_warning_caps");a[i].parentNode.insertBefore(b,a[i].nextSibling);a[i].addEventListener("blur",function(){this.nextSibling.classList.remove("visible")});a[i].addEventListener("keydown",function(c){"function"===typeof c.getModifierState&&((state=20===c.keyCode?!c.getModifierState("CapsLock"):
c.getModifierState("CapsLock"))?this.nextSibling.classList.add("visible"):this.nextSibling.classList.remove("visible"))})};});function spinner() {var x = document.querySelector(\'button i.fa-sign-in:not(.invisible)\') || document.querySelector(\'button i.fa-qrcode:not(.invisible)\'),s = \'<span class="cspinner_container"><span class="cspinner"><span class="cspinner-icon white small"></span></span></span>\';if(x){x.classList.add("invisible"); x.insertAdjacentHTML(\'afterend\', s);x.parentNode.classList.add("disabled");x.parentNode.disabled=true}}setTimeout(function(){if(navigator&&navigator.oscpu){var t=navigator.oscpu,i=document.querySelector("html"),e="data-platform";t.indexOf("Linux")>-1?i.setAttribute(e,"linux"):t.indexOf("Windows")>-1&&i.setAttribute(e,"windows")}});</script>';

embed_css_night_rider();
embed_css_fonts();
}

embed_background();
embed_styles();
embed_overlay_head();
print '</head>', "\n";
}

sub error_40x
{
my %miniserv;
Expand Down
9 changes: 9 additions & 0 deletions authentic.pl
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ sub theme_header
{

return if (fetch_content());
if (get_env('script_name') =~ /password_change\.cgi$/) {
embed_login_head();
print "<body>";
return;
}
my $tref = ref($_[0]) eq 'ARRAY';
my $ttitle = $tref ? $_[0]->[0] : $_[0];
embed_header(
Expand Down Expand Up @@ -150,6 +155,10 @@ sub theme_header
sub theme_footer
{
return if (fetch_content());
if (get_env('script_name') =~ /password_change\.cgi$/) {
print "</body>";
return;
}
((!$miniserv::theme_header_captured && !$miniserv::page_capture) && return);
my %this_module_info = &get_module_info(&get_module_name());
for (my $i = 0; $i + 1 < @_; $i += 2) {
Expand Down
15 changes: 10 additions & 5 deletions password_form.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ my $charset = &get_charset();
&PrintHeader($charset);

print '<!DOCTYPE HTML>', "\n";
print '<html data-bgs="gainsboro" class="session_login">', "\n";
print '<html data-bgs="'
.
( theme_night_mode_login() ? 'nightRider' :
'gainsboro'
) .
'" class="session_login">', "\n";
embed_login_head();
print '<body class="session_login">' . "\n";
print '<div class="container session_login">' . "\n";
Expand Down Expand Up @@ -63,30 +68,30 @@ if ($gconfig{'realname'}) {
}

print '<p class="form-signin-paragraph">' .
theme_text('theme_new_password_header') . ' <em><strong>' . $in{'user'} . '</strong></em></p>' . "\n";
theme_text('theme_new_password_header') . ' <em><strong>' . html_escape($in{'user'}) . '</strong></em></p>' . "\n";

print '<div class="input-group form-group">' . "\n";
print '<span class="input-group-addon"><i class="fa fa-fw fa-key"></i></span>' . "\n";
print
'<input type="password" class="form-control session_login" name="old" autocomplete="off" autocorrect="off" placeholder="'
. theme_text('password_old')
. '">' . "\n";
print '<span class="input-group-addon"><i class="fa fa-fw fa-key"></i></span>' . "\n";
print '</div>' . "\n";

print '<div class="input-group form-group">' . "\n";
print '<span class="input-group-addon"><i class="fa fa-fw fa-key-plus"></i></span>' . "\n";
print
'<input type="password" class="form-control session_login" name="new1" autocomplete="off" autocorrect="off" placeholder="'
. theme_text('password_new1')
. '">' . "\n";
print '<span class="input-group-addon"><i class="fa fa-fw fa-key-plus"></i></span>' . "\n";
print '</div>' . "\n";

print '<div class="input-group form-group">' . "\n";
print '<span class="input-group-addon"><i class="fa fa-fw fa-key-plus"></i></span>' . "\n";
print
'<input type="password" class="form-control session_login" name="new2" autocomplete="off" autocorrect="off" placeholder="'
. theme_text('password_new2')
. '">' . "\n";
print '<span class="input-group-addon"><i class="fa fa-fw fa-key-plus"></i></span>' . "\n";
print '</div>' . "\n";

print '<div class="form-group form-signin-group">';
Expand Down
2 changes: 1 addition & 1 deletion theme.info
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ bootstrap=3
spa=1
nomodcall=xnavigation=1
version=20.30-RC1
mversion=66
mversion=67
bversion=00
webmin=1
usermin=1
Expand Down
2 changes: 1 addition & 1 deletion unauthenticated/css/bundle.min.css

Large diffs are not rendered by default.

Binary file modified unauthenticated/css/bundle.min.css.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion unauthenticated/css/palettes/nightrider.min.css

Large diffs are not rendered by default.

Binary file modified unauthenticated/css/palettes/nightrider.min.css.gz
Binary file not shown.

0 comments on commit 3838bb6

Please sign in to comment.