Skip to content

feat(auth) confirm password #471

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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";
},
Expand Down
3 changes: 2 additions & 1 deletion app/templates/_bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,21 @@ <h1>Change Password</h1>
<form class="form" name="form" ng-submit="changePassword(form)" novalidate>

<div class="form-group">
<label>Current Password</label>
<label for="password">Current Password</label>

<input type="password" name="password" class="form-control" ng-model="user.oldPassword"
id="password"
mongoose-error/>
<p class="help-block" ng-show="form.password.$error.mongoose">
{{ errors.other }}
</p>
</div>

<div class="form-group">
<label>New Password</label>
<label for="newPassword">New Password</label>

<input type="password" name="newPassword" class="form-control" ng-model="user.newPassword"
id="newPassword"
ng-minlength="3"
required/>
<p class="help-block"
Expand All @@ -30,6 +32,22 @@ <h1>Change Password</h1>
</p>
</div>


<div class="form-group">
<label for="passwordConfirm">Confirm New Password</label>

<input type="password" name="passwordConfirm" class="form-control" ng-model="passwordConfirm"
id="passwordConfirm"
ng-minlength="3"
required
ng-confirm-field
confirm-against="user.newPassword"/>
<p class="help-block"
ng-show="form.passwordConfirm.$error.noMatch && submitted">
Passwords must match.
</p>
</div>

<p class="help-block"> {{ message }} </p>

<button class="btn btn-lg btn-primary" type="submit">Save changes</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,23 @@ div(ng-include='"components/navbar/navbar.html"')
.col-sm-12
form.form(name='form', ng-submit='changePassword(form)', novalidate='')
.form-group
label Current Password
input.form-control(type='password', name='password', ng-model='user.oldPassword', mongoose-error='')
label(for="password") Current Password
input.form-control#password(type='password', name='password', ng-model='user.oldPassword', mongoose-error='')
p.help-block(ng-show='form.password.$error.mongoose')
| {{ errors.other }}
.form-group
label New Password
input.form-control(type='password', name='newPassword', ng-model='user.newPassword', ng-minlength='3', required='')
label(for="newPassword") New Password
input.form-control#newPassword(type='password', name='newPassword', ng-model='user.newPassword', ng-minlength='3', required='')
p.help-block(ng-show='(form.newPassword.$error.minlength || form.newPassword.$error.required) && (form.newPassword.$dirty || submitted)')
| Password must be at least 3 characters.

.form-group
label(for="passwordConfirm") Confirm New Password
input.form-control(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 && submitted')
| Passwords must match.

p.help-block {{ message }}

button.btn.btn-lg.btn-primary(type='submit') Save changes
26 changes: 23 additions & 3 deletions app/templates/client/app/account(auth)/signup/signup(html).html
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ <h1>Sign up</h1>

<div class="form-group" ng-class="{ 'has-success': form.name.$valid && submitted,
'has-error': form.name.$invalid && submitted }">
<label>Name</label>
<label for="name">Name</label>

<input type="text" name="name" class="form-control" ng-model="user.name"
id="name"
required/>
<p class="help-block" ng-show="form.name.$error.required && submitted">
A name is required
Expand All @@ -21,9 +22,10 @@ <h1>Sign up</h1>

<div class="form-group" ng-class="{ 'has-success': form.email.$valid && submitted,
'has-error': form.email.$invalid && submitted }">
<label>Email</label>
<label for="email">Email</label>

<input type="email" name="email" class="form-control" ng-model="user.email"
id="email"
required
mongoose-error/>
<p class="help-block" ng-show="form.email.$error.email && submitted">
Expand All @@ -39,9 +41,10 @@ <h1>Sign up</h1>

<div class="form-group" ng-class="{ 'has-success': form.password.$valid && submitted,
'has-error': form.password.$invalid && submitted }">
<label>Password</label>
<label for="password">Password</label>

<input type="password" name="password" class="form-control" ng-model="user.password"
id="password"
ng-minlength="3"
required
mongoose-error/>
Expand All @@ -54,6 +57,23 @@ <h1>Sign up</h1>
</p>
</div>

<div class="form-group" ng-class="{ 'has-success': form.passwordConfirm.$valid && submitted,
'has-error': form.passwordConfirm.$invalid && submitted }">
<label for="passwordConfirm">Confirm Password</label>

<input type="password" name="passwordConfirm" class="form-control" ng-model="passwordConfirm"
ng-minlength="3"
id="passwordConfirm"
ng-confirm-field
confirm-against="user.password"
required/>
<p class="help-block"
ng-show="form.passwordConfirm.$error.noMatch && submitted">
Passwords must match.
</p>

</div>

<div>
<button class="btn btn-inverse btn-lg btn-login" type="submit">
Sign up
Expand Down
20 changes: 14 additions & 6 deletions app/templates/client/app/account(auth)/signup/signup(jade).jade
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ div(ng-include='"components/navbar/navbar.html"')
form.form(name='form', ng-submit='register(form)', novalidate='')
.form-group(ng-class='{ "has-success": form.name.$valid && submitted,\
"has-error": form.name.$invalid && submitted }')
label Name
input.form-control(type='text', name='name', ng-model='user.name', required='')
label(for="name") Name
input.form-control#name(type='text', name='name', ng-model='user.name', required='')
p.help-block(ng-show='form.name.$error.required && submitted')
| A name is required

.form-group(ng-class='{ "has-success": form.email.$valid && submitted,\
"has-error": form.email.$invalid && submitted }')
label Email
input.form-control(type='email', name='email', ng-model='user.email', required='', mongoose-error='')
label(for="email") Email
input.form-control#email(type='email', name='email', ng-model='user.email', required='', mongoose-error='')
p.help-block(ng-show='form.email.$error.email && submitted')
| Doesn't look like a valid email.
p.help-block(ng-show='form.email.$error.required && submitted')
Expand All @@ -25,13 +25,21 @@ div(ng-include='"components/navbar/navbar.html"')

.form-group(ng-class='{ "has-success": form.password.$valid && submitted,\
"has-error": form.password.$invalid && submitted }')
label Password
input.form-control(type='password', name='password', ng-model='user.password', ng-minlength='3', required='', mongoose-error='')
label(for="password") Password
input.form-control#password(type='password', name='password', ng-model='user.password', ng-minlength='3', required='', mongoose-error='')
p.help-block(ng-show='(form.password.$error.minlength || form.password.$error.required) && submitted')
| Password must be at least 3 characters.
p.help-block(ng-show='form.password.$error.mongoose')
| {{ errors.password }}

.form-group(ng-class='{ "has-success": form.passwordConfirm.$valid && submitted,\
"has-error": form.passwordConfirm.$invalid && submitted }')
label(for="passwordConfirm") Confirm Password
input.form-control#passwordConfirm(type='password', name='passwordConfirm', ng-model='passwordConfirm', ng-minlength='3', required='', mongoose-error='\
' ng-confirm-field="", confirm-against="user.password")
p.help-block(ng-show='form.passwordConfirm.$error.noMatch && submitted')
| Passwords must match.

div
button.btn.btn-inverse.btn-lg.btn-login(type='submit')
| Sign up
Expand Down
3 changes: 2 additions & 1 deletion app/templates/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ module.exports = function(config) {
'client/bower_components/angular-bootstrap/ui-bootstrap-tpls.js',<% } %>
'client/bower_components/lodash/dist/lodash.compat.js',<% if(filters.socketio) { %>
'client/bower_components/angular-socket-io/socket.js',<% } %><% if(filters.uirouter) { %>
'client/bower_components/angular-ui-router/release/angular-ui-router.js',<% } %>
'client/bower_components/angular-ui-router/release/angular-ui-router.js',<% } %><% if(filters.auth) { %>
'client/bower_components/angular-confirm-field/app/package/js/angular-confirm-field.min.js',<% } %>
'client/app/app.js',
'client/app/app.coffee',
'client/app/**/*.js',
Expand Down