X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Flogin.pl;h=25379dd7a86b8e5194af8010a4c06dc6bb2e53e0;hb=841d44c00aae1166a0721e40dc2f9ffb7b9ac5b5;hp=622db697dbdba1121371e9dd2c3b1f9b3fdac23c;hpb=b2945bf61775161f9ce9be9bdbd106ad44247a14;p=kivitendo-erp.git diff --git a/bin/mozilla/login.pl b/bin/mozilla/login.pl index 622db697d..25379dd7a 100644 --- a/bin/mozilla/login.pl +++ b/bin/mozilla/login.pl @@ -27,10 +27,9 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ####################################################################### -use DBI; -use SL::Auth; -use SL::User; +use SL::DB::Default; use SL::Form; +use SL::Git; require "bin/mozilla/common.pl"; require "bin/mozilla/todo.pl"; @@ -39,133 +38,22 @@ use strict; our $cgi; our $form; -our $locale; our $auth; -sub run { - $::lxdebug->enter_sub; - my $session_result = shift; - - $cgi = $::cgi; - $form = $::form; - $locale = $::locale; - $auth = $::auth; - - $form->{stylesheet} = "lx-office-erp.css"; - $form->{favicon} = "favicon.ico"; - - if (SL::Auth::SESSION_EXPIRED == $session_result) { - $form->{error_message} = $locale->text('The session is invalid or has expired.'); - login_screen(); - ::end_of_request(); - } - my $action = $form->{action}; - if (!$action && $auth->{SESSION}->{login}) { - $action = 'login'; - } - if ($action) { - our %myconfig = $auth->read_user($form->{login}) if ($form->{login}); - - if (!$myconfig{login} || (SL::Auth::OK != $auth->authenticate($form->{login}, $form->{password}, 0))) { - $form->{error_message} = $locale->text('Incorrect Password!'); - login_screen(); - } else { - $auth->set_session_value('login', $form->{login}, 'password', $form->{password}); - $auth->create_or_refresh_session(); - - $form->{titlebar} .= " - $myconfig{name} - $myconfig{dbname}"; - call_sub($locale->findsub($action)); - } - } else { - login_screen(); - } - - $::lxdebug->leave_sub; -} - -sub login_screen { - $main::lxdebug->enter_sub(); - my ($msg) = @_; - - if (-f "css/lx-office-erp.css") { - $form->{stylesheet} = "lx-office-erp.css"; - } - - $form->{msg} = $msg; - $form->header(); - - print $form->parse_html_template('login/login_screen'); - - $main::lxdebug->leave_sub(); -} - -sub login { - $main::lxdebug->enter_sub(); - - unless ($form->{login}) { - login_screen($locale->text('You did not enter a name!')); - ::end_of_request(); - } - - my $user = new User $form->{login}; - - # if we get an error back, bale out - my $result; - if (($result = $user->login($form)) <= -1) { - ::end_of_request() if $result == -2; - login_screen($locale->text('Incorrect username or password!')); - ::end_of_request(); - } - - my %style_to_script_map = ( 'v3' => 'v3', - 'neu' => 'new', - 'v4' => 'v4', - 'xml' => 'XML', - ); - - my $menu_script = $style_to_script_map{$user->{menustyle}} || ''; - - # made it this far, execute the menu - # standard redirect does not seem to work for this invocation, (infinite loops?) - # do a manual invocation instead -# $form->{callback} = build_std_url("script=menu${menu_script}.pl", 'action=display', "callback=" . $form->escape($form->{callback})); - - $main::auth->set_cookie_environment_variable(); - - $::form->{script} = "menu${menu_script}.pl"; - $::form->{action} = 'display'; - $::form->{callback} = $::form->escape($::form->{callback}); - - require "bin/mozilla/$::form->{script}"; - display(); - -# $form->redirect(); - - $main::lxdebug->leave_sub(); -} - -sub logout { - $main::lxdebug->enter_sub(); - - $main::auth->destroy_session(); - - # remove the callback to display the message - $form->{callback} = "login.pl?action="; - $form->redirect($locale->text('You are logged out!')); - - $main::lxdebug->leave_sub(); -} - sub company_logo { $main::lxdebug->enter_sub(); my %myconfig = %main::myconfig; - $locale = new Locale $myconfig{countrycode}, "login" if ($main::language ne $myconfig{countrycode}); - - $form->{todo_list} = create_todo_list('login_screen' => 1) if (!$form->{no_todo_list}); + $form->{todo_list} = create_todo_list('login_screen' => 1) if (!$form->{no_todo_list}) and ($main::auth->check_right($form->{login}, 'productivity')); $form->{stylesheet} = $myconfig{stylesheet}; - $form->{title} = $locale->text('About'); + $form->{title} = $::locale->text('kivitendo'); + $form->{interface} = $::dispatcher->interface_type; + $form->{client} = $::auth->client; + $form->{defaults} = SL::DB::Default->get; + + my $git = SL::Git->new; + ($form->{git_head}) = $git->get_log(since => 'HEAD~1', until => 'HEAD') if $git->is_git_installation; # create the logo screen $form->header() unless $form->{noheader}; @@ -175,22 +63,6 @@ sub company_logo { $main::lxdebug->leave_sub(); } -sub show_error { - my $template = shift; - my %myconfig = %main::myconfig; - $locale = Locale->new($main::language, 'all'); - $myconfig{countrycode} = $main::language; - $form->{stylesheet} = 'css/lx-office-erp.css'; - - $form->header(); - print $form->parse_html_template($template); - - # $form->parse_html_template('login/auth_db_unreachable'); - # $form->parse_html_template('login/authentication_pl_missing'); - - ::end_of_request(); -} - 1; __END__