summaryrefslogtreecommitdiff
path: root/widgets.js
diff options
context:
space:
mode:
authorjmoenig <jens@moenig.org>2013-05-06 19:46:17 +0200
committerjmoenig <jens@moenig.org>2013-05-06 19:46:17 +0200
commitb5ddbfbc7558dbdf2c7291598dd9d8face1fa229 (patch)
treef4dbafec7d24a62e17638e93d4348ee96e7c8167 /widgets.js
parentf22338b3a962c9008f14ac6997ce64f4b28cdd8f (diff)
downloadsnap-byow-b5ddbfbc7558dbdf2c7291598dd9d8face1fa229.tar.gz
snap-byow-b5ddbfbc7558dbdf2c7291598dd9d8face1fa229.zip
Reset Password Feature
(front end only)
Diffstat (limited to 'widgets.js')
-rw-r--r--widgets.js24
1 files changed, 21 insertions, 3 deletions
diff --git a/widgets.js b/widgets.js
index a2e4582..b95dfe6 100644
--- a/widgets.js
+++ b/widgets.js
@@ -73,7 +73,7 @@ newCanvas, StringMorph, Morph, TextMorph, nop, detect, StringFieldMorph,
HTMLCanvasElement, fontHeight, SymbolMorph, localize, SpeechBubbleMorph,
ArrowMorph, MenuMorph, isString, isNil, SliderMorph*/
-modules.widgets = '2013-April-24';
+modules.widgets = '2013-May-06';
var PushButtonMorph;
var ToggleButtonMorph;
@@ -1805,7 +1805,8 @@ DialogBoxMorph.prototype.promptCredentials = function (
dof.add(mCol);
dof.add(yCol);
inp.add(dof);
- inp.add(emlLabel = labelText('foo'));
+ emlLabel = labelText('foo');
+ inp.add(emlLabel);
inp.add(eml);
}
@@ -1823,6 +1824,14 @@ DialogBoxMorph.prototype.promptCredentials = function (
inp.add(pw2);
}
+ if (purpose === 'resetPassword') {
+ inp.add(labelText('User name:'));
+ inp.add(usr);
+ emlLabel = labelText('E-mail address:');
+ inp.add(emlLabel);
+ inp.add(eml);
+ }
+
if (msg) {
bdy.add(labelText(msg));
}
@@ -1912,6 +1921,8 @@ DialogBoxMorph.prototype.promptCredentials = function (
checklist = [usr, bmn, byr, eml];
} else if (purpose === 'changePassword') {
checklist = [opw, pw1, pw2];
+ } else if (purpose === 'resetPassword') {
+ checklist = [usr, eml];
}
empty = detect(
@@ -1945,6 +1956,13 @@ DialogBoxMorph.prototype.promptCredentials = function (
return false;
}
}
+ if (purpose === 'resetPassword') {
+ if (em.indexOf(' ') > -1 || em.indexOf('@') === -1
+ || em.indexOf('.') === -1) {
+ indicate(eml, 'please provide a valid\nemail address');
+ return false;
+ }
+ }
if (purpose === 'signup') {
if (!agree) {
indicate(chk, 'please agree to\nthe TOS');
@@ -1963,7 +1981,7 @@ DialogBoxMorph.prototype.promptCredentials = function (
this.edit = function () {
if (purpose === 'changePassword') {
opw.edit();
- } else { // 'signup', 'login'
+ } else { // 'signup', 'login', 'resetPassword'
usr.edit();
}
};