From 709d0c0fdd5456279483e6f9fce26acc728eee64 Mon Sep 17 00:00:00 2001 From: erickson Date: Thu, 29 Apr 2010 19:59:45 +0000 Subject: [PATCH] forward-ported the functionality for use-last-4-of-phone-as-default-password based on org setting git-svn-id: svn://svn.open-ils.org/ILS/trunk@16352 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../web/js/ui/default/actor/user/register.js | 28 ++++++++++++++++++- .../templates/default/actor/user/register.tt2 | 4 +-- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/Open-ILS/web/js/ui/default/actor/user/register.js b/Open-ILS/web/js/ui/default/actor/user/register.js index 3c6c47cd90..0dd3321d41 100644 --- a/Open-ILS/web/js/ui/default/actor/user/register.js +++ b/Open-ILS/web/js/ui/default/actor/user/register.js @@ -82,6 +82,7 @@ function load() { if(orgSettings[k]) orgSettings[k] = orgSettings[k].value; + uEditUsePhonePw = orgSettings['patron.password.use_phone']; uEditFetchUserSettings(userId); if(userId) { @@ -387,6 +388,9 @@ function fleshFMRow(row, fmcls, args) { var wclass = row.getAttribute('wclass'); var wstyle = row.getAttribute('wstyle'); var wconstraints = row.getAttribute('wconstraints'); + + var isPasswd2 = (fmfield == 'passwd2'); + if(isPasswd2) fmfield = 'passwd'; var fieldIdl = fieldmapper.IDL.fmclasses[fmcls].field_map[fmfield]; if(!args) args = {}; @@ -438,6 +442,10 @@ function fleshFMRow(row, fmcls, args) { disabled : disabled }; + // TODO RSN: Add Setting! + if(fmcls == 'au' && fmfield == 'dob') + dijitArgs.popupClass = ""; + var value = row.getAttribute('wvalue'); if(value !== null) dijitArgs.value = value; @@ -454,11 +462,15 @@ function fleshFMRow(row, fmcls, args) { parentNode : span, widgetClass : wclass, dijitArgs : dijitArgs, + orgDefaultsToWs : true, orgLimitPerms : ['UPDATE_USER'], }); widget.build(); + // now put it back before we register the widget + if(isPasswd2) fmfield = 'passwd2'; + widget._wtype = fmcls; widget._fmfield = fmfield; widget._addr = args.addr; @@ -588,6 +600,19 @@ function attachWidgetEvents(fmcls, fmfield, widget) { return; case 'day_phone': + // if configured, use the last for digits of the day phone number as the password + if(uEditUsePhonePw && patron.isnew()) { + dojo.connect(widget.widget, 'onChange', + function(newVal) { + if(newVal && newVal.length >= 4) { + var pw1 = findWidget('au', 'passwd').widget; + var pw2 = findWidget('au', 'passwd2').widget; + pw1.attr('value', newVal.substring(newVal.length - 4)); + pw2.attr('value', newVal.substring(newVal.length - 4)); + } + } + ); + } case 'evening_phone': case 'other_phone': dojo.connect(widget.widget, 'onChange', @@ -808,7 +833,8 @@ function _uEditSave(doClone) { switch(w._wtype) { case 'au': - patron[w._fmfield](val); + if(w._fmfield != 'passwd2') + patron[w._fmfield](val); break; case 'ac': diff --git a/Open-ILS/web/templates/default/actor/user/register.tt2 b/Open-ILS/web/templates/default/actor/user/register.tt2 index 355ef70e0f..02a394ea02 100644 --- a/Open-ILS/web/templates/default/actor/user/register.tt2 +++ b/Open-ILS/web/templates/default/actor/user/register.tt2 @@ -91,7 +91,7 @@ - Verify Password + Verify Password @@ -100,7 +100,7 @@ - + -- 2.43.2