Bugzilla – Attachment 105557 Details for
Bug 25349
Enter in the username field submits the login, instead of moving focus to the password field
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25349: Add checkEnter function and apply it to SCO page
Bug-25349-Add-checkEnter-function-and-apply-it-to-.patch (text/plain), 3.54 KB, created by
ByWater Sandboxes
on 2020-06-04 14:32:45 UTC
(
hide
)
Description:
Bug 25349: Add checkEnter function and apply it to SCO page
Filename:
MIME Type:
Creator:
ByWater Sandboxes
Created:
2020-06-04 14:32:45 UTC
Size:
3.54 KB
patch
obsolete
>From 4a69ee42a06172a17a724b105f20d0b8ed925815 Mon Sep 17 00:00:00 2001 >From: Lucas Gass <lucas@bywatersolutions.com> >Date: Tue, 5 May 2020 18:04:11 +0000 >Subject: [PATCH] Bug 25349: Add checkEnter function and apply it to SCO page > >This patch adds the checkEnter function to the OPAC global.js and then applies it to the SCO login page. >TO TEST: >1. Go to SCO login and try entering something in the "Login:" input amd "Password:" input. >2. Pressing enter while in either will automatically submit the form. >3. Apply patch. >4. Type something into the Login: field and press enter, the form should NOT submit. >5. Type something into the Password: field and pess enter, this SHOULD submit the form. >6. Change the syspref SelfCheckoutByLogin to 'Cardnumber' >7. Type something into the Please enter your card number: field, the form should submit. > >Signed-off-by: Donnab <donna@bywatersolutions.com> >--- > .../opac-tmpl/bootstrap/en/modules/sco/sco-main.tt | 2 +- > koha-tmpl/opac-tmpl/bootstrap/js/global.js | 22 ++++++++++++++++++++++ > 2 files changed, 23 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt >index 4b3fe8a652..c428886a4d 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt >@@ -372,7 +372,7 @@ > [% IF ( Koha.Preference('SelfCheckoutByLogin') ) %] > <legend>Log in to your account</legend> > <label for="patronlogin">Login:</label> >- <input type="text" id="patronlogin" class="focus" size="20" name="patronlogin" /> >+ <input type="text" id="patronlogin" class="focus noEnterSubmit" size="20" name="patronlogin" /> > <label for="patronpw">Password:</label> > <input type="password" id="patronpw" size="20" name="patronpw" /> > <fieldset class="action"> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/global.js b/koha-tmpl/opac-tmpl/bootstrap/js/global.js >index 76ce7b5cb0..166c361052 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/js/global.js >+++ b/koha-tmpl/opac-tmpl/bootstrap/js/global.js >@@ -52,6 +52,28 @@ function suffixOf (s, tok) { > return s.substring(index + 1); > } > >+$("body").on("keypress", ".noEnterSubmit", function(e){ >+ return checkEnter(e); >+}); >+ >+// http://jennifermadden.com/javascript/stringEnterKeyDetector.html >+function checkEnter(e){ //e is event object passed from function invocation >+ var characterCode; // literal character code will be stored in this variable >+ if(e && e.which){ //if which property of event object is supported (NN4) >+ characterCode = e.which; //character code is contained in NN4's which property >+ } else { >+ characterCode = e.keyCode; //character code is contained in IE's keyCode property >+ } >+ if( characterCode == 13 //if generated character code is equal to ascii 13 (if enter key) >+ && e.target.nodeName == "INPUT" >+ && e.target.type != "submit" // Allow enter to submit using the submit button >+ ){ >+ return false; >+ } else { >+ return true; >+ } >+} >+ > // Adapted from https://gist.github.com/jnormore/7418776 > function confirmModal(message, title, yes_label, no_label, callback) { > $("#bootstrap-confirm-box-modal").data('confirm-yes', false); >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 25349
:
104378
|
105446
|
105533
|
105556
|
105557
|
105858