Add button to reset password via email tadl/rel_2_7_4
authorJeff Godin <jgodin@tadl.org>
Fri, 18 Sep 2015 18:17:07 +0000 (14:17 -0400)
committerJeff Godin <jgodin@tadl.org>
Fri, 18 Sep 2015 18:42:22 +0000 (14:42 -0400)
Add button to user editor to request a password reset link be sent
via email.

Signed-off-by: Jeff Godin <jgodin@tadl.org>
Open-ILS/src/templates/actor/user/register_table.tt2
Open-ILS/web/js/ui/default/actor/user/register.js

index d3f19a0..7680853 100644 (file)
             <button dojoType='dijit.form.Button' jsId='generatePassword' scrollOnFocus='false' tabIndex='-1'></button>
         </td>
     </tr>
-    <tr fmclass='au' fmfield='passwd2' required='required'><td/><td id='verifyPassword'></td><td/></tr>
+    <tr fmclass='au' fmfield='passwd2' required='required'><td/><td id='verifyPassword'></td><td/>
+        <td>
+            <button dojoType='dijit.form.Button' jsId='requestPasswordResetViaEmail' scrollOnFocus='false' tabIndex='-1'></button>
+        </td>
+    </tr>
     <tr fmclass='au' fmfield='prefix'/>
     <tr fmclass='au' fmfield='first_given_name' required='required'/>
     <tr fmclass='au' fmfield='second_given_name'/>
index fe7a201..8de7aa6 100644 (file)
@@ -87,6 +87,7 @@ function load() {
     allCards.attr("label", localeStrings.SEE_ALL);
     dojo.byId('uedit-dupe-username-warning').innerHTML = localeStrings.DUPE_USERNAME;
     generatePassword.attr("label", localeStrings.RESET_PASSWORD);
+    requestPasswordResetViaEmail.attr("label", 'Send Password Reset Link');
     setExpireDate.attr("label", localeStrings.UPDATE_EXPIRE_DATE);
     dojo.byId('verifyPassword').innerHTML = localeStrings.VERIFY_PASSWORD;
     dojo.byId('parentGuardian').innerHTML = localeStrings.PARENT_OR_GUARDIAN;
@@ -303,6 +304,8 @@ function load() {
 
        dojo.connect(generatePassword, 'onClick', generatePasswordHandler);
 
+       dojo.connect(requestPasswordResetViaEmail, 'onClick', requestPasswordResetViaEmailHandler);
+
        dojo.connect(setExpireDate, 'onClick', setExpireDateHandler);
 
     if(!patron.isnew() && !checkGrpAppPerm(patron.profile()) && patron.id() != openils.User.user.id()) {
@@ -609,6 +612,18 @@ function generatePasswordHandler() {
        f.widget.attr('value', patron.passwd());
 }
 
+function requestPasswordResetViaEmailHandler() {
+    if (patron.email()) {
+        var resp = fieldmapper.standardRequest(
+            ['open-ils.actor', 'open-ils.actor.patron.password_reset.request'],
+            { params : ['barcode', patron.card().barcode(), patron.email()] }
+        )
+        alert('Submitted request for password reset link to be sent via email.');
+    } else {
+        alert('Patron must have email address on file to perform a password reset via email.');
+    }
+}
+
 /**
  * Generate a potential usrname for the patron.
  */