Slight cleanup in login.js.
@@ -17,8 +17,10 @@ function genLoginConf() {
<span class="wl__button__caption">Sign in</span>
<img src="generated/icon-sprite.svg#ico16_arrow_up_hi" class="wl__button__carret">
</a>
- <!-- <div ng-form="loginForm">-->
- <form ng-submit="::self.login({email: self.email, password: self.password}, {redirectToFeed: true})" id="loginForm" class="loginForm">
+ <form ng-submit="::self.login({email: self.email, password: self.password}, {redirectToFeed: true})"
+ id="loginForm"
+ class="loginForm"
+ >
<input
id="loginEmail"
placeholder="Email address"
@@ -26,7 +28,7 @@ function genLoginConf() {
type="email"
required
autofocus
- ng-keyup="self.loginReset() || ($event.keyCode == 13 && self.login({email: self.email, password: self.password}, {redirectToFeed: true}))"/>
+ ng-keyup="self.formKeyUp($event)"/>
<span class="wl__errormsg">
{{self.loginError}}
</span>
@@ -36,7 +38,7 @@ function genLoginConf() {
ng-model="self.password"
type="password"
required
- ng-keyup="self.loginReset() || ($event.keyCode == 13 && self.login({email: self.email, password: self.password}, {redirectToFeed: true}))"/>
+ ng-keyup="self.formKeyUp($event)"/>
<!-- <input type="submit" value="LOGIN"/>-->
<button
@@ -92,6 +94,18 @@ function genLoginConf() {
});
}
+ formKeyUp(event) {
+ this.loginReset();
+ if(event.keyCode == 13) {
+ this.login({
+ email: this.email,
+ password: this.password
+ }, {
+ redirectToFeed: true
+ });
+ }
+ }
+
/**
* auto-fill hack. firefox doesn't fire an input event when auto-filling,
* so we do this here manually to make sure the ng-model updates itself.
