0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

fix setup controller to pass in only a valid email to the profile-image component

closes #5563
This commit is contained in:
Austin Burdine 2015-07-15 17:03:32 -04:00
parent 5c637dd37a
commit 04d649a224
2 changed files with 10 additions and 2 deletions

View file

@ -7,6 +7,7 @@ export default Ember.Controller.extend(ValidationEngine, {
blogTitle: null,
name: null,
email: '',
validEmail: '',
password: null,
image: null,
submitting: false,
@ -102,6 +103,13 @@ export default Ember.Controller.extend(ValidationEngine, {
},
setImage: function (image) {
this.set('image', image);
},
handleEmail: function () {
var self = this;
this.validate({property: 'email'}).then(function () {
self.set('validEmail', self.get('email'));
});
}
}
});

View file

@ -8,11 +8,11 @@
<input style="display:none;" type="text" name="fakeusernameremembered"/>
<input style="display:none;" type="password" name="fakepasswordremembered"/>
{{gh-profile-image fileStorage=config.fileStorage email=email setImage="setImage"}}
{{gh-profile-image fileStorage=config.fileStorage email=validEmail setImage="setImage"}}
{{#gh-form-group errors=errors property="email"}}
<label for="email-address">Email address</label>
<span class="input-icon icon-mail">
{{gh-input type="email" name="email" placeholder="Eg. john@example.com" class="gh-input" autofocus="autofocus" autocorrect="off" value=email focusOut=(action "validate" "email")}}
{{gh-input type="email" name="email" placeholder="Eg. john@example.com" class="gh-input" autofocus="autofocus" autocorrect="off" value=email focusOut=(action "handleEmail")}}
</span>
{{gh-error-message errors=errors property="email"}}
{{/gh-form-group}}