From 0a4b3fb5fc105d9f4078f133fbcc04300eca5f23 Mon Sep 17 00:00:00 2001 From: Scott Angel Date: Tue, 24 Jan 2023 11:26:17 -0600 Subject: [PATCH] LP1977554 - Add Password visibility toggle on login screens Added an icon to each login input of a closed eye when input type is set to password. If you click the icon it switches to an open eye and the input type is set to text. It's a pretty standard way to allow people to view their password before submitting it. Signed-off-by: Scott Angel Signed-off-by: Stephanie Leary Signed-off-by: Galen Charlton --- .../src/eg2/src/app/staff/login.component.html | 24 +++++++++++++--------- Open-ILS/src/eg2/src/app/staff/login.component.ts | 6 ++++++ Open-ILS/src/eg2/src/styles.css | 9 +++++++- .../src/templates-bootstrap/opac/css/style.css.tt2 | 4 ++++ .../src/templates-bootstrap/opac/parts/base.tt2 | 8 ++++++++ .../templates-bootstrap/opac/parts/login/form.tt2 | 5 ++++- .../opac/parts/login/login_modal.tt2 | 5 ++++- Open-ILS/src/templates/opac/css/style.css.tt2 | 3 +++ Open-ILS/src/templates/opac/parts/js.tt2 | 11 ++++++++++ Open-ILS/src/templates/opac/parts/login/form.tt2 | 6 +++++- Open-ILS/src/templates/staff/t_login.tt2 | 17 +++++++++++++-- 11 files changed, 82 insertions(+), 16 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/login.component.html b/Open-ILS/src/eg2/src/app/staff/login.component.html index 939fe52344..987cd6a99f 100644 --- a/Open-ILS/src/eg2/src/app/staff/login.component.html +++ b/Open-ILS/src/eg2/src/app/staff/login.component.html @@ -24,16 +24,20 @@
- + + + {{ passwordVisible ? 'visibility' : 'visibility_off' }} +
diff --git a/Open-ILS/src/eg2/src/app/staff/login.component.ts b/Open-ILS/src/eg2/src/app/staff/login.component.ts index 50ec9c6068..02d6580afb 100644 --- a/Open-ILS/src/eg2/src/app/staff/login.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/login.component.ts @@ -15,6 +15,7 @@ export class StaffLoginComponent implements OnInit { loginFailed: boolean; routeTo: string; pendingXactsDate: Date; + passwordVisible: boolean; args = { username : '', @@ -118,6 +119,11 @@ export class StaffLoginComponent implements OnInit { } ); } + + togglePasswordVisibility() { + this.passwordVisible = !this.passwordVisible; + } + } diff --git a/Open-ILS/src/eg2/src/styles.css b/Open-ILS/src/eg2/src/styles.css index bf4b3254b7..ca59afa619 100644 --- a/Open-ILS/src/eg2/src/styles.css +++ b/Open-ILS/src/eg2/src/styles.css @@ -560,4 +560,11 @@ a { .popover-body { padding: 0; -} \ No newline at end of file +} + +/* + CSS Cursor classes +*/ +.pointer { + cursor: pointer; +} diff --git a/Open-ILS/src/templates-bootstrap/opac/css/style.css.tt2 b/Open-ILS/src/templates-bootstrap/opac/css/style.css.tt2 index 1a9e146acd..92d651bebd 100755 --- a/Open-ILS/src/templates-bootstrap/opac/css/style.css.tt2 +++ b/Open-ILS/src/templates-bootstrap/opac/css/style.css.tt2 @@ -4019,3 +4019,7 @@ padding: 15px; .form-control { border: 1px solid [% css_colors.border_standard %]; } + +.pointer { + cursor: pointer; +} diff --git a/Open-ILS/src/templates-bootstrap/opac/parts/base.tt2 b/Open-ILS/src/templates-bootstrap/opac/parts/base.tt2 index 91030b7dc8..bff11bd670 100755 --- a/Open-ILS/src/templates-bootstrap/opac/parts/base.tt2 +++ b/Open-ILS/src/templates-bootstrap/opac/parts/base.tt2 @@ -65,6 +65,14 @@ $("#loginModal").on('shown.bs.modal', function(){ $(this).find('#username_field').focus(); }); + // password visibility eye + let btn = document.getElementById('show_password'); + let input = document.getElementById('password_field'); + let icon = btn.querySelector('i'); + btn.addEventListener('click', () => { + input.type == 'password' ? [input.type = 'text', icon.setAttribute('class','fas fa-eye')] : [input.type = 'password', icon.setAttribute('class', 'fas fa-eye-slash')]; + input.focus(); + }); }); diff --git a/Open-ILS/src/templates-bootstrap/opac/parts/login/form.tt2 b/Open-ILS/src/templates-bootstrap/opac/parts/login/form.tt2 index fcd8d87640..b9a09bdb1c 100755 --- a/Open-ILS/src/templates-bootstrap/opac/parts/login/form.tt2 +++ b/Open-ILS/src/templates-bootstrap/opac/parts/login/form.tt2 @@ -38,7 +38,10 @@
- +
+ + +
diff --git a/Open-ILS/src/templates-bootstrap/opac/parts/login/login_modal.tt2 b/Open-ILS/src/templates-bootstrap/opac/parts/login/login_modal.tt2 index a778b7ccd7..bbbb560dae 100755 --- a/Open-ILS/src/templates-bootstrap/opac/parts/login/login_modal.tt2 +++ b/Open-ILS/src/templates-bootstrap/opac/parts/login/login_modal.tt2 @@ -45,7 +45,10 @@
- +
+ + +
diff --git a/Open-ILS/src/templates/opac/css/style.css.tt2 b/Open-ILS/src/templates/opac/css/style.css.tt2 index c17da05a39..07cdb14bbd 100644 --- a/Open-ILS/src/templates/opac/css/style.css.tt2 +++ b/Open-ILS/src/templates/opac/css/style.css.tt2 @@ -3501,3 +3501,6 @@ span.egtd { display:table-cell; } */ +.pointer { + cursor: pointer; +} diff --git a/Open-ILS/src/templates/opac/parts/js.tt2 b/Open-ILS/src/templates/opac/parts/js.tt2 index c597c31863..0e35c0fae4 100644 --- a/Open-ILS/src/templates/opac/parts/js.tt2 +++ b/Open-ILS/src/templates/opac/parts/js.tt2 @@ -42,6 +42,17 @@ } + + + [%- IF ctx.use_stripe %] [% END -%] diff --git a/Open-ILS/src/templates/opac/parts/login/form.tt2 b/Open-ILS/src/templates/opac/parts/login/form.tt2 index 6ceca0b5dd..c84ed85c7a 100644 --- a/Open-ILS/src/templates/opac/parts/login/form.tt2 +++ b/Open-ILS/src/templates/opac/parts/login/form.tt2 @@ -57,7 +57,11 @@
- + +
+
+ +
[% INCLUDE "opac/parts/login/password_hint.tt2" %] [% IF reset_password == 'true' %] diff --git a/Open-ILS/src/templates/staff/t_login.tt2 b/Open-ILS/src/templates/staff/t_login.tt2 index 2dc7fc4221..0ad9813b8a 100644 --- a/Open-ILS/src/templates/staff/t_login.tt2 +++ b/Open-ILS/src/templates/staff/t_login.tt2 @@ -24,8 +24,11 @@
- +
+ + +
@@ -67,3 +70,13 @@
+ \ No newline at end of file -- 2.11.0