Restore the Reset Password button on patron editor
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 30 Mar 2011 01:41:08 +0000 (01:41 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 30 Mar 2011 01:41:08 +0000 (01:41 +0000)
Per LP 488243, the Reset Password button that existed on the old
XUL patron editor was lost in the transition to the new Dojo
patron editor. Jason Stephenson stepped up and offered a patch
to restore the functionality.

Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>

git-svn-id: svn://svn.open-ils.org/ILS/trunk@19906 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/web/js/ui/default/actor/user/register.js
Open-ILS/web/templates/default/actor/user/register_table.tt2

index 4025f5c..8c078fc 100644 (file)
@@ -207,6 +207,10 @@ function load() {
         input.widget.attr('disabled', true).attr('readOnly', true);
     }
 
+       dojo.connect(generatePassword, 'onClick', generatePasswordHandler);
+       if (uEditUsePhonePw) {
+               generatePassword.attr('disabled', true);
+       }
 
     if(!patron.isnew() && !checkGrpAppPerm(patron.profile()) && patron.id() != openils.User.user.id()) {
         // we are not allowed to edit this user, so disable the save option
@@ -326,6 +330,16 @@ function replaceCardHandler() {
         patron.cards(t);
 }
 
+/**
+ * Generate a random password for the patron.
+ */
+function generatePasswordHandler() {
+       uEditMakeRandomPw(patron);
+       var f = findWidget('au', 'passwd');
+       f.widget.attr('value', patron.passwd());
+       f = findWidget('au', 'passwd2');
+       f.widget.attr('value', patron.passwd());
+}
 
 /**
  * Loads a staged user and turns them into something the editor can understand
index 30eeb5c..e8672a5 100644 (file)
             </span>
         </td>
     </tr>
-    <tr fmclass='au' fmfield='passwd' required='required'/>
+    <tr fmclass='au' fmfield='passwd' required='required'>
+        <td/><td/><td/>
+        <td>
+            <button dojoType='dijit.form.Button' jsId='generatePassword' scrollOnFocus='false'>Generate Password</button>
+        </td>
+    </tr>
     <tr fmclass='au' fmfield='passwd2' required='required'><td/><td>Verify Password</td><td/></tr>
     <tr fmclass='au' fmfield='first_given_name' required='required'/>
     <tr fmclass='au' fmfield='second_given_name'/>