From 3772d03ab5a1d64173504ca61bf737dfcd451a92 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 11 Jun 2013 17:39:40 +0200 Subject: [PATCH] Mandantenauswahl in Loginbildschirm anzeigen --- SL/Controller/LoginScreen.pm | 20 ++++++++++++++++ .../webpages/login_screen/user_login.html | 24 +++++++++++++++---- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/SL/Controller/LoginScreen.pm b/SL/Controller/LoginScreen.pm index 13b7b8a8c..6c31a9055 100644 --- a/SL/Controller/LoginScreen.pm +++ b/SL/Controller/LoginScreen.pm @@ -4,10 +4,20 @@ use strict; use parent qw(SL::Controller::Base); +use List::Util qw(first); + use SL::Dispatcher::AuthHandler::User; +use SL::DB::AuthClient; +use SL::DB::AuthGroup; +use SL::DB::AuthUser; use SL::User; +use Rose::Object::MakeMethods::Generic ( + 'scalar --get_set_init' => [ qw(clients default_client_id) ], +); + __PACKAGE__->run_before('set_layout'); + # # actions # @@ -122,4 +132,14 @@ sub set_layout { $::request->{layout} = SL::Layout::Dispatcher->new(style => 'login'); } +sub init_clients { + return SL::DB::Manager::AuthClient->get_all_sorted; +} + +sub init_default_client_id { + my ($self) = @_; + my $default_client = first { $_->is_default } @{ $self->clients }; + return $default_client ? $default_client->id : undef; +} + 1; diff --git a/templates/webpages/login_screen/user_login.html b/templates/webpages/login_screen/user_login.html index d9756e3ad..453b07e70 100644 --- a/templates/webpages/login_screen/user_login.html +++ b/templates/webpages/login_screen/user_login.html @@ -1,5 +1,5 @@ [%- USE T8 %] -[%- USE HTML %] +[%- USE HTML %][%- USE L -%][%- USE LxERP -%]
@@ -11,8 +11,8 @@

[% END %] -

- +[% IF SELF.clients.size %] +[%- SET style="width: 250px" %]
@@ -23,11 +23,15 @@

- + - + + + + +
[% 'Login Name' | $T8 %][% L.input_tag('{AUTH}login', '', style=style) %]
[% 'Password' | $T8 %][% L.input_tag('{AUTH}password', '', type='password', style=style) %]
[% 'Client' | $T8 %][% L.select_tag('{AUTH}client_id', SELF.clients, title_key='name', default=SELF.default_client_id, style=style) %]
@@ -40,6 +44,16 @@ +[%- ELSE %] +

+ [% LxERP.t8("No clients have been created yet.") %] + [% LxERP.t8("Please do so in the administration area.") %] +

+ +

+ [% LxERP.t8("Administration area") %] +

+[%- END %] -- 2.20.1