From 0f6ef0a44a76348c839391615ec849b2810ff680 Mon Sep 17 00:00:00 2001 From: Thomas Porter Date: Sun, 24 Aug 2014 14:34:36 -0400 Subject: [PATCH] feat(auth) add confirm password to signup and settings also adding for attribute to labels with and ids to associated elements confirm password powered by directive: https://github.com/wongatech/angular-confirm-field Files Modified: app/index.js app/templates/_bower.json app/templates/client/app/account(auth)/settings/settings(html).html app/templates/client/app/account(auth)/settings/settings(jade).jade app/templates/client/app/account(auth)/signup/signup(html).html app/templates/client/app/account(auth)/signup/signup(jade).jade app/templates/karma.conf.js test/fixtures/bower.json take note of new dependency in test/fixtures/bower.json (re-run bower install on current clones...) --- app/index.js | 1 + app/templates/_bower.json | 3 +- .../settings/settings(html).html | 24 ++++++++++++---- .../settings/settings(jade).jade | 15 +++++++--- .../account(auth)/signup/signup(html).html | 28 +++++++++++++++---- .../account(auth)/signup/signup(jade).jade | 20 +++++++++---- app/templates/karma.conf.js | 3 +- test/fixtures/bower.json | 3 +- 8 files changed, 74 insertions(+), 23 deletions(-) diff --git a/app/index.js b/app/index.js index 4154db1f2..fa5d94e8f 100644 --- a/app/index.js +++ b/app/index.js @@ -248,6 +248,7 @@ var AngularFullstackGenerator = yeoman.generators.Base.extend({ if(this.filters.socketio) angModules.push("'btford.socket-io'"); if(this.filters.uirouter) angModules.push("'ui.router'"); if(this.filters.uibootstrap) angModules.push("'ui.bootstrap'"); + if(this.filters.auth) angModules.push("'ng.confirmField'"); this.angularModules = "\n " + angModules.join(",\n ") +"\n"; }, diff --git a/app/templates/_bower.json b/app/templates/_bower.json index 1681050a2..46fac9b66 100644 --- a/app/templates/_bower.json +++ b/app/templates/_bower.json @@ -16,7 +16,8 @@ "font-awesome": ">=4.1.0", "lodash": "~2.4.1"<% if(filters.socketio) { %>, "angular-socket-io": "~0.6.0"<% } %><% if(filters.uirouter) { %>, - "angular-ui-router": "~0.2.10"<% } %> + "angular-ui-router": "~0.2.10"<% } %><% if(filters.auth) { %>, + "angular-confirm-field": "~0.1.2"<% } %> }, "devDependencies": { "angular-mocks": ">=1.2.*", diff --git a/app/templates/client/app/account(auth)/settings/settings(html).html b/app/templates/client/app/account(auth)/settings/settings(html).html index 94d0ee013..f02708292 100644 --- a/app/templates/client/app/account(auth)/settings/settings(html).html +++ b/app/templates/client/app/account(auth)/settings/settings(html).html @@ -28,9 +28,9 @@

<% if (filters.oauth) { %>{{ user.localEnabled ? 'Change' : 'Set' }}<% } els
- + - ng-disabled='!user.localEnabled' <% } %>/>

{{ errors.other }} @@ -38,9 +38,9 @@

<% if (filters.oauth) { %>{{ user.localEnabled ? 'Change' : 'Set' }}<% } els

- + -

<% if (filters.oauth) { %>{{ user.localEnabled ? 'Change' : 'Set' }}<% } els

+
+ + + +

+ Passwords must match. +

+
+

{{ message }}

@@ -63,4 +77,4 @@

Social accounts

--> <% } %> - \ No newline at end of file + diff --git a/app/templates/client/app/account(auth)/settings/settings(jade).jade b/app/templates/client/app/account(auth)/settings/settings(jade).jade index 8565781c2..4b167301c 100644 --- a/app/templates/client/app/account(auth)/settings/settings(jade).jade +++ b/app/templates/client/app/account(auth)/settings/settings(jade).jade @@ -24,17 +24,24 @@ div(ng-include='"components/navbar/navbar.html"') form(role='form', name='pwd', ng-submit='<% if(filters.oauth) { %>!user.localEnabled ? setPassword() : <% } %>changePassword()', novalidate) .form-group - label Current Password - input.form-control(type='password', name='old', placeholder='ex. password123', ng-model='user.oldPassword', <% if (filters.oauth) { %>ng-disabled='!user.localEnabled', <% } %>mongoose-error='') + label(for="oldPass") Current Password + input.form-control#oldPass(type='password', name='old', placeholder='ex. password123', ng-model='user.oldPassword', <% if (filters.oauth) { %>ng-disabled='!user.localEnabled', <% } %>mongoose-error='') p.help-block(ng-show='pwd.old.$error.mongoose') | {{ errors.other }} .form-group - label New Password - input.form-control(type='password', name='new', placeholder='ex. GoofyM1ckeyDonald&Pluto', ng-model='user.newPassword', ng-minlength='3', required) + label(for="newPass") New Password + input.form-control#newPass(type='password', name='new', placeholder='ex. GoofyM1ckeyDonald&Pluto', ng-model='user.newPassword', ng-minlength='3', required) p.help-block(ng-show='(pwd.new.$error.minlength || pwd.new.$error.required) && (pwd.new.$dirty || pwd.submitted)') | Password must be at least 3 characters. + .form-group + label(for="passwordConfirm") Confirm New Password + input.form-control#passwordConfirm(type='password', name='passwordConfirm', ng-model='passwordConfirm', ng-minlength='3', required='\ + ', ng-confirm-field='', confirm-against="user.newPassword") + p.help-block(ng-show='form.passwordConfirm.$error.noMatch && pwd.submitted') + | Passwords must match. + p.help-block {{ message }} button.btn.btn-lg.btn-primary(type='submit') Save changes diff --git a/app/templates/client/app/account(auth)/signup/signup(html).html b/app/templates/client/app/account(auth)/signup/signup(html).html index 59faed568..76b409be5 100644 --- a/app/templates/client/app/account(auth)/signup/signup(html).html +++ b/app/templates/client/app/account(auth)/signup/signup(html).html @@ -10,9 +10,9 @@

Sign up

- + -

A name is required @@ -21,9 +21,9 @@

Sign up

- + -

@@ -39,9 +39,10 @@

Sign up

- + @@ -54,6 +55,23 @@

Sign up

+
+ + + +

+ Passwords must match. +

+ +
+