From ff5dd07a0acf6c97ce34580cc640592d36378094 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zsirafovics=20=28Gy=C3=B6rgy=20T=C3=B3th-Szab=C3=B3=29?= Date: Tue, 20 Jan 2026 15:03:21 +0100 Subject: [PATCH] CORE: login.pl refactor according to HTML5 --- bin/mozilla/login.pl | 779 +++++++++++++++++++++++++++++-------------- 1 file changed, 534 insertions(+), 245 deletions(-) diff --git a/bin/mozilla/login.pl b/bin/mozilla/login.pl index 8cffe238..ee368509 100644 --- a/bin/mozilla/login.pl +++ b/bin/mozilla/login.pl @@ -15,11 +15,22 @@ use SL::User; use SL::Form; use SL::Locale; +use Storable (); + +sub h { + my ($s) = @_; + $s = '' unless defined $s; + $s =~ s/&/&/g; + $s =~ s//>/g; + $s =~ s/"/"/g; + $s =~ s/'/'/g; + return $s; +} $form = SL::Form->new; - $locale = SL::Locale->new($slconfig{language}, "login"); # $form->{charset} = $slconfig{charset}; @@ -42,98 +53,176 @@ &login_screen; } - 1; +sub login_env_html { + my ($form, $locale) = @_; -sub login_screen { + my $env = $form->environment; - $form->{stylesheet} = "sql-ledger.css"; - $form->{favicon} = "favicon.ico"; + my %env_label = ( + dev => $locale->text('Development Environment'), + test => $locale->text('Test Environment'), + ); - $form->header; + my $version_label = $locale->text('Version'); - $focus = ($form->{login}) ? "password" : "login"; + if (exists $env_label{$env}) { + return qq{ +
+ +
+ }; + } - print qq| - + return qq{ +
+ +
+ }; +} -
+sub login_screen {
 
+  $form->{stylesheet} = "blue.css";
+  $form->{favicon} = "favicon.ico";
 
+  $form->header;
 
+  $focus = ($form->{login}) ? "user" : "login";
 
+  my $env_html = login_env_html($form, $locale);
 
+  print qq|
+
+
+
 
-
+ @@ -146,76 +235,117 @@ sub login_screen { sub selectdataset { my ($login) = @_; - if (-f "css/sql-ledger.css") { - $form->{stylesheet} = "sql-ledger.css"; + if (-f "css/blue.css") { + $form->{stylesheet} = "blue.css"; } if (-f 'favicon.ico') { $form->{favicon} = "favicon.ico"; } - delete $self->{sessioncookie}; + delete $form->{sessioncookie}; $form->header(1); - print qq| - - -
+  my $env_html = login_env_html($form, $locale);
+  my $login_h  = h($form->{login});
 
-
- -
- - - - - - - - - - - - - |; + +
$user->{totp_secret}
+ |; } $form->{stylesheet} = $user->{stylesheet}; @@ -559,50 +821,75 @@ sub totp_screen { $form->header; - print qq| - - - -
-
-
- -
-
- - - - + @@ -636,8 +923,10 @@ sub totp_login { # made it this far, setup callback for the menu $form->{callback} = "menu.pl?action=display"; - for (qw(login path password js sessioncookie small_device)) { - $form->{callback} .= "&$_=$form->{$_}"; + for my $k (qw(login path js sessioncookie small_device)) { + my $v = $form->{$k}; + next unless defined $v; + $form->{callback} .= "&$k=" . $form->escape($v, 1); } # check for recurring transactions