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
#
$::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;
[%- USE T8 %]
-[%- USE HTML %]
+[%- USE HTML %][%- USE L -%][%- USE LxERP -%]
<center>
<table class="login" border="3" cellpadding="20">
<tr>
<p><span class="message_error_login">[% error %]</span></p>
[% END %]
- <p>
-
+[% IF SELF.clients.size %]
+[%- SET style="width: 250px" %]
<form method="post" name="loginscreen" action="controller.pl" target="_top">
<input type="hidden" name="show_dbupdate_warning" value="1">
<table>
<tr>
<th align="right">[% 'Login Name' | $T8 %]</th>
- <td><input id='input_login' class="login" name="{AUTH}login" size="30" tabindex="1"></td>
+ <td>[% L.input_tag('{AUTH}login', '', style=style) %]</td>
</tr>
<tr>
<th align="right">[% 'Password' | $T8 %]</th>
- <td><input class="login" type="password" name="{AUTH}password" size="30" tabindex="2"></td>
+ <td>[% L.input_tag('{AUTH}password', '', type='password', style=style) %]</td>
+ </tr>
+ <tr>
+ <th align="right">[% 'Client' | $T8 %]</th>
+ <td>[% L.select_tag('{AUTH}client_id', SELF.clients, title_key='name', default=SELF.default_client_id, style=style) %]</td>
</tr>
</table>
</table>
</form>
+[%- ELSE %]
+ <p>
+ [% LxERP.t8("No clients have been created yet.") %]
+ [% LxERP.t8("Please do so in the administration area.") %]
+ </p>
+
+ <p>
+ <a href="controller.pl?action=Admin/login">[% LxERP.t8("Administration area") %]</a>
+ </p>
+[%- END %]
</td>
</tr>