diff --git a/core/client/app/components/gh-profile-image.js b/core/client/app/components/gh-profile-image.js index 0d00886183..cf2e45fffd 100644 --- a/core/client/app/components/gh-profile-image.js +++ b/core/client/app/components/gh-profile-image.js @@ -51,8 +51,7 @@ export default Ember.Component.extend({ previewMaxWidth: size, previewCrop: true, maxNumberOfFiles: 1, - autoUpload: false, - acceptFileTypes: /(\.|\/)(gif|jpe?g|png|svg?z)$/i + autoUpload: false }) .on('fileuploadadd', Ember.run.bind(this, this.queueFile)) .on('fileuploadprocessalways', Ember.run.bind(this, this.triggerPreview)); @@ -63,14 +62,17 @@ export default Ember.Component.extend({ }, queueFile: function (e, data) { - this.set('hasUploadedImage', true); - // send image data to controller - this.sendAction('setImage', data); + var fileName = data.files[0].name; + + if ((/\.(gif|jpe?g|png|svg?z)$/i).test(fileName)) { + this.sendAction('setImage', data); + } }, triggerPreview: function (e, data) { var file = data.files[data.index]; if (file.preview) { + this.set('hasUploadedImage', true); // necessary jQuery code because file.preview is a raw DOM object // potential todo: rename 'gravatar-img' class in the CSS to be something // that both the gravatar and the image preview can use that's not so confusing diff --git a/core/client/app/controllers/setup/two.js b/core/client/app/controllers/setup/two.js index 2d9c7879dd..1252f8c049 100644 --- a/core/client/app/controllers/setup/two.js +++ b/core/client/app/controllers/setup/two.js @@ -47,7 +47,7 @@ export default Ember.Controller.extend(ValidationEngine, { actions: { setup: function () { var self = this, - data = self.getProperties('blogTitle', 'name', 'email', 'password'), + data = self.getProperties('blogTitle', 'name', 'email', 'password', 'image'), notifications = this.get('notifications'); this.toggleProperty('submitting'); diff --git a/core/client/app/validators/new-user.js b/core/client/app/validators/new-user.js index 9ed270460a..45fa54b588 100644 --- a/core/client/app/validators/new-user.js +++ b/core/client/app/validators/new-user.js @@ -14,7 +14,10 @@ var NewUserValidator = BaseValidator.extend({ email: function (model) { var email = model.get('email'); - if (!validator.isEmail(email)) { + if (validator.empty(email)) { + model.get('errors').add('email', 'Please enter an email.'); + this.invalidate(); + } else if (!validator.isEmail(email)) { model.get('errors').add('email', 'Invalid Email.'); this.invalidate(); }