Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring and repairing login form #424

Merged
merged 6 commits into from
Oct 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion default/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,6 @@ nobase_default_DATA = \
web_tt2/lists.tt2 \
web_tt2/loginbanner.tt2 \
web_tt2/login_menu.tt2 \
web_tt2/loginrequest.tt2 \
web_tt2/login.tt2 \
web_tt2/ls_templates.tt2 \
web_tt2/maintenance.tt2 \
Expand Down
3 changes: 3 additions & 0 deletions default/mail_tt2/report.tt2
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,9 @@
[%~ ELSIF report_entry == 'user_notified' ~%]
[%|loc(report_param.notified_user)%]User %1 has been notified[%END%]

[%~ ELSIF report_entry == 'logout' ~%]
[%|loc%]You have logged out[%END%]

[%~ END ~%]

[%################~%]
Expand Down
7 changes: 1 addition & 6 deletions default/web_tt2/including_lists.tt2
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- including_lists.tt2 -->
<h2><i class="fa fa-envelope-square"></i> [%|loc(list)%]Lists including %1[%END%]</h2>
[% IF user.email ~%]

[% IF which.size ~%]
<p>[%|loc(list)%]Following lists are including list %1.[%END%]</p>

Expand Down Expand Up @@ -48,9 +48,4 @@

[%~ END %]

[%~ ELSE ~%]
<article>
[% PROCESS loginrequest.tt2 %]
</article>
[%~ END %]
<!-- end including_lists.tt2 -->
137 changes: 136 additions & 1 deletion default/web_tt2/login.tt2
Original file line number Diff line number Diff line change
@@ -1,4 +1,139 @@
<!-- login.tt2 -->
[% IF back_to_mom ~%]
<p>
[%|loc(user.email)%]You have logged in with email address %1[%END%]
</p>
[% ELSE ~%]

[%|loc(user.email)%]You have logged in with email address %1.[%END%]<br />
<h2>
<i class="fa fa-user"></i>
[% IF use_sso && use_passwd && only_passwd ~%]
[%|loc%]Login locally[%END%]
[%~ ELSE ~%]
[%|loc%]Login[%END%]
[%~ END %]
</h2>

<p>
[%|loc%]In order to perform a privileged operation (one that requires your email address), you need to login.[%END%]
</p>

[% IF use_sso && !only_passwd ~%]
<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="list" value="[% list %]" />
<input type="hidden" name="action" value="sso_login" />
<input type="hidden" name="nomenu" value="[% nomenu %]" />
[% 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>
[% END # IF use_sso && !only_passwd ~%]

[% IF use_passwd && use_sso && !only_passwd ~%]
<hr />
<h3>
<i class="fa fa-user"></i> [%|loc%]Login locally[%END%]
</h3>
[% END ~%]

[% IF use_passwd ~%]
<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="only_passwd" value="[% only_passwd %]" />
<input type="hidden" name="referer" value="[% referer %]" />
<input type="hidden" name="failure_referer" value="[% failure_referer %]" />
<input type="hidden" name="list" value="[% list %]" />
<input type="hidden" name="action" value="login" />
<input type="hidden" name="nomenu" value="[% nomenu %]" />
<input type="hidden" name="submit" value="submit" />
<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="[% 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>

[% IF authentication_info_url || ! is_ldap_user ~%]
<hr />
[% END ~%]

[% IF authentication_info_url ~%]
<ul>
<li><a class="menuLinks" href="[%authentication_info_url%]">
[%|loc%]Authentication help[% END %]
</a></li>
</ul>
[%~ ELSIF is_ldap_user ~%]
[%# No guides %]
[%~ ELSIF email ~%]
<ul>
<li><a href="[% 'firstpasswd' | url_rel([],{email=>email}) %]">
[%|loc%]First login?[%END%]
</a></li>
<li><a href="[% 'renewpasswd' | url_rel([],{email=>email}) %]">
[%|loc%]Lost password?[%END%]
</a></li>
</ul>
[%~ ELSE ~%]
<ul>
<li><a href="[% 'firstpasswd' | url_rel %]">
[%|loc%]First login?[%END%]
</a></li>
<li><a href="[% 'renewpasswd' | url_rel %]">
[%|loc%]Lost password?[%END%]
</a></li>
</ul>
[%~ END %]
[% END # IF use_passwd ~%]
[% END # IF back_to_mom ~%]
<!-- end login.tt2 -->
7 changes: 3 additions & 4 deletions default/web_tt2/login_menu.tt2
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
<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 ~%]
Expand Down Expand Up @@ -43,16 +42,16 @@
[%~ END %]

[% IF use_passwd == '1' ~%]
[% IF action == 'loginrequest'; SET class = 'active'; END ~%]
[% IF action == 'login'; 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" />
<input type="hidden" name="only_passwd" value="1" />
[%~ END %]
<span><button type="submit" name="action_loginrequest"
<span><button type="submit" name="action_login"
value="[%|loc%]Login[%END%]">
<i class="fa fa-user"></i>
[% IF use_sso ~%]
Expand Down
123 changes: 0 additions & 123 deletions default/web_tt2/loginrequest.tt2

This file was deleted.

6 changes: 3 additions & 3 deletions default/web_tt2/main.tt2
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
[% END -%]
</head>

<body onload="[% IF back_to_mom %] setTimeout('refresh_mom_and_die()',1000);[% END %]">
<body[%IF back_to_mom%] class="backToMom"[%END%]>

[% top_menu = 1 %]

Expand All @@ -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 %]
Expand Down Expand Up @@ -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'%]

Expand Down
7 changes: 1 addition & 6 deletions default/web_tt2/my.tt2
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- my.tt2 -->
<h2><i class="fa fa-envelope-square"></i> [%|loc%]My lists[%END%]</h2>
[% IF user.email %]

<p>[%|loc%]You are subscribed to or managing the following lists.[%END%]</p>

<form class="noborder" action="[% path_cgi %]" method="post" name="suspend_request">
Expand Down Expand Up @@ -62,9 +62,4 @@

</form>

[% ELSE %]
<article>
[% PROCESS loginrequest.tt2 %]
</article>
[% END %]
<!-- end my.tt2 -->
11 changes: 8 additions & 3 deletions default/web_tt2/notice.tt2
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
<!-- 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%]

Expand Down
Loading