Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Block users from trying to submit an empty password.

  • Loading branch information...
commit 9cb9e857d6aecae53ae9e9825fc555e40d32b6f9 1 parent 3bba3dd
@knowtheory knowtheory authored
Showing with 14 additions and 7 deletions.
  1. +14 −7 public/javascripts/ui/accounts/account_view.js
View
21 public/javascripts/ui/accounts/account_view.js
@@ -90,14 +90,21 @@ dc.ui.AccountView = Backbone.View.extend({
promptPasswordChange : function() {
this.dialog.close();
var dialog = dc.ui.Dialog.prompt('Enter your new password:', '', _.bind(function(password) {
- this.model.save({password : password}, {success : _.bind(function() {
- dc.ui.notifier.show({
- text : 'Password updated',
- duration : 5000,
- mode : 'info'
+ if (password.length > 0) {
+ this.model.save({password : password}, {
+ success : _.bind(function() {
+ dc.ui.notifier.show({
+ text : 'Password updated',
+ duration : 5000,
+ mode : 'info'
+ });
+ }, this),
+ error: _.bind(function() { alert("Failed") }, this)
});
- }, this)});
- return true;
+ return true;
+ } else {
+ dc.ui.Dialog.alert("Your password can't be blank");
+ };
}, this), {password : true, mode : 'short_prompt'});
},

2 comments on commit 9cb9e85

@jashkenas
Owner

Do we really want to alert(), ever? Perhaps just omit the error handler instead.

@knowtheory
Owner

Yes, thanks for the catch. That was a stub for responding to validation errors on passwords (which i haven't fleshed out yet).

Please sign in to comment.
Something went wrong with that request. Please try again.