Commit 09849e21 authored by IKEDA Soji's avatar IKEDA Soji
Browse files

[-bug] Information of the last login was not shown.

parent 3919c087
......@@ -39,7 +39,7 @@
[% IF nomenu %]
[% PROCESS error.tt2 IF errors %]
<div class="nomenu">
[% PROCESS notice.tt2 IF notices %]
[% PROCESS notice.tt2 IF notices || last_login_epoch %]
[% PROCESS "${action}.tt2" IF action %]
</div>
[% ELSE %]
......@@ -77,7 +77,7 @@
[% PROCESS nav.tt2 %]
[%~ END %]
[% PROCESS notice.tt2 IF notices %]
[% PROCESS notice.tt2 IF notices || last_login_epoch %]
[% PROCESS "${action}.tt2" IF action %]
[% PROCESS dumpvars.tt2 IF dumpvars == 'true'%]
......
<!-- notice.tt2 -->
<div id="ephemeralMsg">
[% IF last_login_date ~%]
[% IF last_login_epoch ~%]
<div data-alert class="alert-box info radius">
<i class="fi-eye"></i>
[%|loc(last_login_host,last_login_date)%]last login from %1 (%2)[%END%]<br/>
<i class="fi-eye"></i>
[% last_login_date = BLOCK ~%]
[% last_login_epoch | optdesc('unixtime') %]
[%~ END ~%]
<p>
[%|loc(last_login_host,last_login_date)%]last login from %1 (%2)[%END%]
</p>
</div>
[%~ END%]
......
......@@ -62,13 +62,6 @@
</li>
[%~ END %]
[% IF last_login_date ~%]
<li><span>
[%|loc(last_login_host)%]last login from %1[%END%]
&nbsp;&nbsp; ([% last_login_date %])
<span></li>
[%~ END %]
<li><a href="[% 'pref' | url_rel %]">
<i class="fa fa-cog"></i> [%|loc%]My preferences[%END%]
</a></li>
......
......@@ -2571,6 +2571,10 @@ sub prepare_report_user {
sub check_param_in {
wwslog('debug2', '');
 
# Restore last login info if any: See do_login() & do_sso_login().
$param->{'last_login_epoch'} = delete $session->{'last_login_date'};
$param->{'last_login_host'} = delete $session->{'last_login_host'};
# listmaster has owner and editor privileges for the list.
if (Sympa::is_listmaster($robot, $param->{'user'}{'email'})) {
$param->{'is_listmaster'} = 1;
......@@ -3103,11 +3107,9 @@ sub do_ticket {
$session->{'email'} = lc($param->{'ticket_context'}{'email'});
$param->{'user'} = Sympa::User::get_global_user($session->{'email'});
$param->{'user'}{'email'} = $session->{'email'};
$param->{'last_login_host'} = $param->{'user'}{'last_login_host'};
$param->{'last_login_date'} =
$language->gettext_strftime("%d %b %Y at %H:%M:%S",
localtime($param->{'user'}{'last_login_date'}))
if ($param->{'user'}{'last_login_date'});
# Save and update last login info.
$session->{'last_login_host'} = $param->{'user'}{'last_login_host'};
$session->{'last_login_date'} = $param->{'user'}{'last_login_date'};
Sympa::User::update_global_user($param->{'user'}{'email'},
{last_login_date => time(), last_login_host => $ip});
} elsif ($param->{'ticket_context'}{'result'} eq 'closed') {
......@@ -3236,16 +3238,14 @@ sub do_login {
 
}
 
$param->{'user'} = $data->{'user'};
$param->{'last_login_host'} = $data->{'user'}{'last_login_host'};
$param->{'last_login_date'} =
$language->gettext_strftime("%d %b %Y at %H:%M:%S",
localtime($data->{'user'}{'last_login_date'}))
if ($data->{'user'}{'last_login_date'});
$param->{'user'} = $data->{'user'};
$session->{'auth'} = $data->{'auth'};
$session->{'email'} = $email =
Sympa::Tools::Text::canonic_email($param->{'user'}{'email'});
 
# Save and update information of last login.
$session->{'last_login_host'} = $param->{'user'}{'last_login_host'};
$session->{'last_login_date'} = $param->{'user'}{'last_login_date'};
Sympa::User::update_global_user(
$param->{'user'}{'email'},
{ last_login_date => time(),
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment