Commit 22c7ef2a authored by IKEDA Soji's avatar IKEDA Soji
Browse files

[-change] Restore login form partially. Password login uses separate login...

[-change] Restore login form partially. Password login uses separate login page but SSO login uses button or dropdown box in menu bar.
parent 20aea9f0
......@@ -312,6 +312,7 @@ nobase_default_DATA = \
web_tt2/title.tt2 \
web_tt2/tracking.tt2 \
web_tt2/tt2_error.tt2 \
web_tt2/user_menu.tt2 \
web_tt2/viewbounce.tt2 \
web_tt2/viewlogs.tt2 \
web_tt2/viewmod.tt2 \
......
......@@ -57,13 +57,14 @@
[% IF user.email %]
<menu class="top-bar-left user">
<ul class="nested vertical menu">
[% PROCESS login_menu.tt2 %]
<li><label><i class="fa fa-user"></i> [% IF user.gecos %][% user.gecos %][% ELSE %][%|loc%]User Information[%END%][% END %]</label></li>
[% PROCESS 'user_menu.tt2' %]
</ul>
</menu>
[% ELSE %]
<menu class="top-bar-left connect">
<ul class="nested vertical menu">
[% PROCESS loginbanner.tt2 %]
[% PROCESS login_menu.tt2 %]
</ul>
</menu>
[% END %]
......
......@@ -23,7 +23,7 @@ html
menu.top-bar-right
ul
(sympa_menu.tt2)
(loginbanner.tt2 or Login link)
(user_menu.tt2 or login_menu.tt2)
div#loading
aside
div.title-bar
......@@ -47,7 +47,8 @@ html
```
* If template variable top_menu unset, there is no header, and
#sympa-sub-bar also contains div#logo, sympa_menu.tt2 and loginbanner.tt2.
#sympa-sub-bar also contains div#logo, sympa_menu.tt2 and user_menu.tt2 /
login_menu.tt2.
Otherwise, #sympa-sub-bar is shown only in list context.
* div.title-bar is title bar launching menu used only on mobile mode.
......@@ -373,8 +374,11 @@ select {
margin-right: 10px;
outline:none;*/
}
select, input {
max-width: 550px;
[%# 641px ~%]
@media only screen and (min-width: 40em) {
select, input {
max-width: 550px;
}
}
select[name="size"] {
max-width: 60px;
......@@ -2184,7 +2188,7 @@ nav menu form{
padding-left: 15px;
}
[% IF 0 # No longer used --- loginbanner.tt2 embeded in top bar. ~%]
[% IF 0 # No longer used --- login menu embeded in top bar. ~%]
#sympa-top-bar menu ul li label {
margin-top:0;
display:inline;
......
......@@ -45,36 +45,19 @@
<i class="fa fa-user"></i> [% user.gecos || user.email %]
</a>
<ul class="vertical menu">
[% PROCESS 'loginbanner.tt2' %]
[% PROCESS 'user_menu.tt2' %]
</ul>
</li>
[%~ ELSIF use_passwd || use_sso || authentication_info_url ~%]
[% IF action == 'loginrequest'; SET class = 'active'; END ~%]
<li class="[% class %]">
<form action="[% path_cgi %]" method="POST">
<fieldset>
<input type="hidden" name="previous_action"
value="[% action %]" />
<input type="hidden" name="previous_list" value="[% list %]" />
<button type="submit" name="action_loginrequest"
value="[%|loc%]Login[%END%]">
<i class="fa fa-user"></i> [%|loc%]Login[%END%]
</button>
</fieldset>
</form>
</li>
[% PROCESS 'login_menu.tt2' %]
[%~ END %]
</ul>
</menu>
</nav>
[% IF top_menu %]
[% IF not list %]
<h1 class="row">[% main_title %]</h1>
[% ELSE %]
<h1 class="medium-offset-3 medium-9 columns">[% main_title %]</h1>
[% END %]
[% ELSE %]
<h1 class="medium-offset-3 medium-9 columns">[% main_title %]</h1>
[% END %]
[% IF not list ~%]
<h1 class="row">[% main_title %]</h1>
[%~ ELSE ~%]
<h1 class="medium-offset-3 medium-9 columns">[% main_title %]</h1>
[%~ END %]
</header>
<!-- end header.tt2 -->
<!-- login_menu.tt2 -->
<li><label><i class="fa fa-user"></i> [% IF user.gecos %][% user.gecos %][% ELSE %][%|loc%]User Information[%END%][% END %]</label></li>
[% PROCESS 'loginbanner.tt2' %]
<!-- login_menu.tt2 -->
[% IF use_sso %]
<li>
<form id="use-sso" action="[% path_cgi %]" method="post">
<fieldset>
<input type="hidden" name="previous_action" value="[% previous_action %]" />
<input type="hidden" name="previous_list" value="[% previous_list %]" />
<input type="hidden" name="referer" value="[% referer %]" />
<input type="hidden" name="list" value="[% list %]" />
<input type="hidden" name="action" value="sso_login" />
[% IF sso_number == 1 %]
[% FOREACH server = sso %]
<input type="hidden" name="auth_service_name" value="[% server.key %]" />
<span><button type="submit" name="action_sso_login" value="[% server.value %]"><i class="fa fa-user"></i> [% server.value %]</button></span>
[% END %]
[% ELSE %]
<span><select id="auth_service_name" name="auth_service_name"
class="submitOnChange"
title="[%|loc%]To login, select your organization authentication server below:[%END%]"
data-tooltip>
<option value="1" selected>---[%|loc%]Click to select[%END%]---</option>
[% FOREACH server = sso %]
<option value="[% server.key %]">[% server.value %]</option>
[% END %]
</select></span>
<noscript><button type="submit" name="action_sso_login" value="[%|loc%]Go[%END%]">[%|loc%]Go[%END%]</button></noscript>
[% END %]
</fieldset>
</form>
</li>
[% END %]
[% IF use_passwd == '1' AND use_sso %]
<li class="divider show-for-small" role="separator"></li>
[% END %]
[% IF use_passwd == '1' %]
[% IF action == 'loginrequest'; SET class = 'active'; END ~%]
<li class="[% class %]">
<form action="[% path_cgi %]" method="POST">
<fieldset>
<input type="hidden" name="previous_action"
value="[% action %]" />
<input type="hidden" name="previous_list" value="[% list %]" />
[% IF use_sso ~%]
<input type="hidden" name="login_method" value="use_passwd" />
[%~ END %]
<span><button type="submit" name="action_loginrequest"
value="[%|loc%]Login[%END%]">
<i class="fa fa-user"></i>
[% IF use_sso ~%]
[%|loc%]Login locally[%END%]
[%~ ELSE ~%]
[%|loc%]Login[%END%]
[%~ END %]
</button></span>
</fieldset>
</form>
</li>
[% END # IF use_passwd == '1' %]
<!-- end login_menu.tt2 -->
<!-- loginbanner.tt2 -->
[% IF user.email %]
[% IF user.gecos %]
<li><span>[% user.email %]</span></li>
[% END %]
[% IF top_menu %]
[%# Note: When is_listmaster is set, is_privileged_owner is also set. %]
[%~ SET owner_item = owner.item(user.email) %]
[%~ SET editor_item = editor.item(user.email) %]
[% IF is_listmaster || owner_item || is_editor || is_subscriber %]
<li class="nolink role"><span>
[%# Show picture and higher privilege of user on this list. %]
[%~ IF is_subscriber && pictures_display && pictures_url ~%]
<img class="Pictures" src="[% pictures_url %]"
alt="[%|loc%]Your picture[%END%]" />
[%~ ELSIF owner_item || is_editor || is_subscriber ~%]
<i class="fa fa-user"></i>
[%~ END %]
[%~ IF is_listmaster ~%]
<i class="fa fa-star" style="color: #669900;"
title="[%|loc%]You are listmaster.[%END%]"></i>
[%~ ELSIF owner_item ~%]
<i class="fa fa-star" title="[%|loc%]You are owner.[%END%]"></i>
[%~ ELSIF is_editor ~%]
<i class="fa fa-star-o" title="[%|loc%]You are editor.[%END%]"></i>
[%~ END %]
[%# Show roles on this list. %]
[%~ IF is_listmaster ~%]
[%|loc%]Listmaster[%END%]
[%~ IF owner_item || is_editor || is_subscriber %][%|loc%], [%END%][% END %]
[%~ END %]
[%~ IF owner_item || is_editor %]
[%~ IF is_privileged_owner ~%]
[%|loc%]Privileged owner[%END%]
[%~ IF is_subscriber %][%|loc%], [%END%][% END %]
[%~ ELSIF is_owner ~%]
[%|loc%]Owner[%END%]
[%~ IF is_subscriber %][%|loc%], [%END%][% END %]
[%~ ELSIF is_editor ~%]
[%|loc%]Editor[%END%]
[%~ IF is_subscriber %][%|loc%], [%END%][% END %]
[%~ END %]
[%~ END %]
[%~ IF is_subscriber ~%]
[%|loc%]Subscriber[%END%]
[%~ END %]
</span></li>
[%~ END %]
[% END %]
[% IF restore_email %]
<li>
<form action="[% path_cgi %]" method="post">
<fieldset>
<span><button type="submit" name="action_restore_email" value="[%|loc%]Restore identity[%END%]" /><i class="fa fa-undo"></i> [%|loc%]Restore identity[%END%]</button></span>
</fieldset>
</form>
</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>
<li><a class="heavyWork" href="[% 'my' | url_rel %]"><i class="fa fa-envelope"></i> [%|loc%]My lists[%END%]</a></li>
<li>
[% IF auth_method == 'md5' %]
<form action="[% path_cgi %]" method="post">
<fieldset>
<input type="hidden" name="action" value="logout" />
[% IF referer %]
<input type="hidden" name="referer" value="[% referer %]" />
[% ELSE %]
<input type="hidden" name="previous_action" value="[% home %]" />
[% END %]
<span><button class="MainMenuLinks" type="submit" name="action_logout" value="[%|loc%]Logout[%END%]"><i class="fa fa-power-off"></i> [%|loc%]Logout[%END%]</button></span>
</fieldset>
</form>
[% END %]
</li>
[% ELSE %]
<li>
[% IF use_sso %]
<form id="use-sso" action="[% path_cgi %]" method="post">
<fieldset>
<input type="hidden" name="previous_action" value="[% previous_action %]" />
<input type="hidden" name="previous_list" value="[% previous_list %]" />
<input type="hidden" name="referer" value="[% referer %]" />
<input type="hidden" name="list" value="[% list %]" />
<input type="hidden" name="action" value="sso_login" />
[% IF sso_number == 1 %]
[% FOREACH server = sso %]
<input type="hidden" name="auth_service_name" value="[% server.key %]" />
<button type="submit" name="action_sso_login" value="[% server.value %]"><i class="fa fa-user"></i> [% server.value %]</button>
[% END %]
[% ELSE %]
<label for="auth_service_name">[%|loc%]To login, select your organization authentication server below:[%END%]</label>
<select id="auth_service_name" name="auth_service_name"
class="submitOnChange">
<option value="1" selected>---[%|loc%]Click to select[%END%]---</option>
[% FOREACH server = sso %]
<option value="[% server.key %]">[% server.value %]</option>
[% END %]
</select>
<noscript><button type="submit" name="action_sso_login" value="[%|loc%]Go[%END%]">[%|loc%]Go[%END%]</button></noscript>
[% END %]
</fieldset>
</form>
[% END %]
</li>
[% IF use_passwd == '1' AND use_sso %]
<li class="divider hide-for-small" role="separator"></li>
[% END %]
[% IF use_passwd == '1' %]
<li id="login-dropdown">
<a href="#"><i class="fa fa-user"></i> [%|loc%]Login[%END%]</a>
<ul class="vertical menu">
<form action="[% path_cgi %]" method="post">
<fieldset>
<input type="hidden" name="previous_action" value="[% previous_action %]" />
<input type="hidden" name="previous_list" value="[% previous_list %]" />
<input type="hidden" name="referer" value="[% referer %]" />
<input type="hidden" name="list" value="[% list %]" />
<input type="hidden" name="action" value="login" />
<li><label for="email_login">[%|loc%]email address:[%END%]
<input type="text" name="email" id="email_login" size="28" value="[% unauthenticated_email %]" /></label></li>
<li><label for="passwd" >[%|loc%]password:[%END%]
<input type="password" name="passwd" id="passwd" size="8" /></label></li>
<li><span><button class="heavyWork" type="submit" name="action_login" value="[%|loc%]Login[%END%]"><i class="fa fa-user"></i> [%|loc%]Go[%END%]</button></span></li>
</fieldset>
</form>
[% IF not top_menu %]
</ul>
</li>
[% END %]
<li class="divider hide-for-small" role="separator"></li>
[% IF authentication_info_url %]
<li><a class="menuLinks" href="[%authentication_info_url%]">
[%|loc%]Authentication help[% END %]
</a></li>
[% ELSIF init_email %]
<li><a href="[% 'firstpasswd' | url_rel([],{email=>init_email}) %]">
[%|loc%]First login?[%END%]
</a></li>
<li><a href="[% 'renewpasswd' | url_rel([],{email=>init_email}) %]">
[%|loc%]Lost password?[%END%]
</a></li>
[% ELSE %]
<li><a href="[% 'firstpasswd' | url_rel %]">
[%|loc%]First login?[%END%]
</a></li>
<li><a href="[% 'renewpasswd' | url_rel %]">
[%|loc%]Lost password?[%END%]
</a></li>
[% END %]
[% IF top_menu %]
</ul>
</li>
[% END %]
[% END %]
[% END %]
[%#
This file is no longer used. It is kept for backward compatibility.
~%]
[% if user.email ~%]
[% PROCESS user_menu.tt2 %]
[%~ ELSE ~%]
[% PROCESS login_menu.tt2 %]
[%~ END %]
<!-- end loginbanner.tt2 -->
<!-- loginrequest.tt2 -->
<h2>
<i class="fa fa-user"></i>
[% UNLESS login_method == 'use_passwd' ~%]
[%|loc%]Login[%END%]
[%~ ELSE ~%]
[%|loc%]Login locally[%END%]
[%~ END %]
</h2>
[%|loc%]In order to perform a privileged operation (one that requires your email address), you need to login.[%END%]
[% PROCESS 'loginbanner.tt2' %]
<p>
[%|loc%]In order to perform a privileged operation (one that requires your email address), you need to login.[%END%]
</p>
[% IF use_sso && !login_method %]
<div class="row">
<div class="columns">
<form id="use-sso" action="[% path_cgi %]" method="post">
<fieldset>
<input type="hidden" name="previous_action" value="[% previous_action %]" />
<input type="hidden" name="previous_list" value="[% previous_list %]" />
<input type="hidden" name="referer" value="[% referer %]" />
<input type="hidden" name="list" value="[% list %]" />
<input type="hidden" name="action" value="sso_login" />
[% IF sso_number == 1 %]
[% FOREACH server = sso %]
<input type="hidden" name="auth_service_name" value="[% server.key %]" />
<button type="submit" name="action_sso_login" value="[% server.value %]"><i class="fa fa-user"></i> [% server.value %]</button>
[% END %]
[% ELSE %]
<label for="auth_service_name">
[%|loc%]To login, select your organization authentication server below:[%END%]
</label>
<select id="auth_service_name" name="auth_service_name"
class="submitOnChange">
<option value="1" selected>---[%|loc%]Click to select[%END%]---</option>
[% FOREACH server = sso %]
<option value="[% server.key %]">[% server.value %]</option>
[% END %]
</select>
<noscript><button type="submit" name="action_sso_login" value="[%|loc%]Go[%END%]">[%|loc%]Go[%END%]</button></noscript>
[% END %]
</fieldset>
</form>
</div>
</div>
[% IF use_passwd == '1' AND use_sso %]
<hr />
[% END %]
[%~ END # IF use_sso && !login_method %]
[% IF use_passwd == '1' %]
[% IF use_sso && !login_method ~%]
<h3>
<i class="fa fa-user"></i>
[%|loc%]Login locally[%END%]
</h3>
[%~ END %]
<form action="[% path_cgi %]" method="post">
<fieldset>
<input type="hidden" name="previous_action" value="[% previous_action %]" />
<input type="hidden" name="previous_list" value="[% previous_list %]" />
<input type="hidden" name="referer" value="[% referer %]" />
<input type="hidden" name="list" value="[% list %]" />
<input type="hidden" name="action" value="login" />
<div class="row">
<div class="columns">
<label for="email_login">[%|loc%]email address:[%END%]</label>
<input type="text" name="email" id="email_login" size="28" value="[% unauthenticated_email %]" />
</div>
</div>
<div class="row">
<div class="columns">
<label for="passwd" >[%|loc%]password:[%END%]</label>
<input type="password" name="passwd" id="passwd" size="8" />
</div>
</div>
<div class="row">
<div class="columns">
<span><button class="heavyWork" type="submit" name="action_login" value="[%|loc%]Login[%END%]"><i class="fa fa-user"></i> [%|loc%]Go[%END%]</button></span>
</div>
</div>
</fieldset>
</form>
<hr />
<ul>
[% IF authentication_info_url %]
<li><a class="menuLinks" href="[%authentication_info_url%]">
[%|loc%]Authentication help[% END %]
</a></li>
[% ELSIF init_email %]
<li><a href="[% 'firstpasswd' | url_rel([],{email=>init_email}) %]">
[%|loc%]First login?[%END%]
</a></li>
<li><a href="[% 'renewpasswd' | url_rel([],{email=>init_email}) %]">
[%|loc%]Lost password?[%END%]
</a></li>
[% ELSE %]
<li><a href="[% 'firstpasswd' | url_rel %]">
[%|loc%]First login?[%END%]
</a></li>
<li><a href="[% 'renewpasswd' | url_rel %]">
[%|loc%]Lost password?[%END%]
</a></li>
[% END %]
</ul>
[% END # IF user_passwd == '1' %]
<!-- end loginrequest.tt2 -->
<!-- user_menu.tt2 -->
[% IF user.gecos %]
<li><span>[% user.email %]</span></li>
[% END %]
[% IF top_menu %]
[%# Note: When is_listmaster is set, is_privileged_owner is also set. %]
[%~ SET owner_item = owner.item(user.email) %]
[%~ SET editor_item = editor.item(user.email) %]
[% IF is_listmaster || owner_item || is_editor || is_subscriber %]
<li class="nolink role"><span>
[%# Show picture and higher privilege of user on this list. %]
[%~ IF is_subscriber && pictures_display && pictures_url ~%]
<img class="Pictures" src="[% pictures_url %]"
alt="[%|loc%]Your picture[%END%]" />
[%~ ELSIF owner_item || is_editor || is_subscriber ~%]
<i class="fa fa-user"></i>
[%~ END %]
[%~ IF is_listmaster ~%]
<i class="fa fa-star" style="color: #669900;"
title="[%|loc%]You are listmaster.[%END%]"></i>
[%~ ELSIF owner_item ~%]
<i class="fa fa-star" title="[%|loc%]You are owner.[%END%]"></i>
[%~ ELSIF is_editor ~%]
<i class="fa fa-star-o" title="[%|loc%]You are editor.[%END%]"></i>
[%~ END %]
[%# Show roles on this list. %]
[%~ IF is_listmaster ~%]
[%|loc%]Listmaster[%END%]
[%~ IF owner_item || is_editor || is_subscriber %][%|loc%], [%END%][% END %]
[%~ END %]
[%~ IF owner_item || is_editor %]
[%~ IF is_privileged_owner ~%]
[%|loc%]Privileged owner[%END%]
[%~ IF is_subscriber %][%|loc%], [%END%][% END %]
[%~ ELSIF is_owner ~%]
[%|loc%]Owner[%END%]
[%~ IF is_subscriber %][%|loc%], [%END%][% END %]
[%~ ELSIF is_editor ~%]
[%|loc%]Editor[%END%]
[%~ IF is_subscriber %][%|loc%], [%END%][% END %]
[%~ END %]
[%~ END %]
[%~ IF is_subscriber ~%]
[%|loc%]Subscriber[%END%]
[%~ END %]
</span></li>
[%~ END %]
[% END %]
[% IF restore_email %]
<li>
<form action="[% path_cgi %]" method="post">
<fieldset>
<span><button type="submit" name="action_restore_email" value="[%|loc%]Restore identity[%END%]" /><i class="fa fa-undo"></i> [%|loc%]Restore identity[%END%]</button></span>
</fieldset>
</form>
</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>
<li><a class="heavyWork" href="[% 'my' | url_rel %]"><i class="fa fa-envelope"></i> [%|loc%]My lists[%END%]</a></li>
<li>
[% IF auth_method == 'md5' %]
<form action="[% path_cgi %]" method="post">
<fieldset>
<input type="hidden" name="action" value="logout" />
[% IF referer %]
<input type="hidden" name="referer" value="[% referer %]" />
[% ELSE %]
<input type="hidden" name="previous_action" value="[% home %]" />
[% END %]
<span><button class="MainMenuLinks" type="submit" name="action_logout" value="[%|loc%]Logout[%END%]"><i class="fa fa-power-off"></i> [%|loc%]Logout[%END%]</button></span>
</fieldset>
</form>
[% END %]
</li>
<!-- end user_menu.tt2 -->
......@@ -4000,7 +4000,7 @@ sub is_ldap_user {
 
## send back login form
sub do_loginrequest {
wwslog('info', '');
wwslog('info', '(%s, %s, %s)', $in{'previous_action'}, $in{'previous_list'}, $in{'login_method'});
 
if ($param->{'user'}{'email'}) {
Sympa::WWW::Report::reject_report_web('user', 'already_login',
......@@ -4024,6 +4024,9 @@ sub do_loginrequest {
$param->{'title'} = 'Login'
if ($param->{'nomenu'});
 
$param->{'login_method'} = $in{'login_method'}
if $in{'login_method'};
return 1;
}
 
......
Markdown is supported
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