[page.noauth.login][vue.noauth.login] form submit when clicking ENTER [page.noauth.register][vue.noauth.register] form submit when clicking ENTER

This commit is contained in:
xdrm-brackets 2018-03-27 19:04:06 +02:00
parent d0328f8da0
commit 912bf003b3
4 changed files with 45 additions and 8 deletions

View File

@ -21,7 +21,8 @@ gs.set('login', {
func: {
print_err(_field, _message, _duration){},
login(){},
forgot_pass(){}
forgot_pass(){},
press_enter(){}
}
});
@ -121,3 +122,21 @@ gs.get.login.func.login = function(){
}, encodeURI(`${username}:${password}`));
}.bind(gs.get.login);
/* (4) Manage pressing on enter
*
---------------------------------------------------------*/
gs.get.login.func.press_enter = function(e){
// if enter -> launch login
if( e.keyCode === 13 )
this.func.login();
}.bind(gs.get.login);

View File

@ -28,8 +28,8 @@ gs.set('register', {
// functions
func: {
print_err(_field, _message, _duration){},
login(){},
forgot_pass(){}
register(){},
press_enter(){}
}
});
@ -139,3 +139,21 @@ gs.get.register.func.register = function(){
}.bind(gs.get.register);
/* (4) Manage pressing on enter
*
---------------------------------------------------------*/
gs.get.register.func.press_enter = function(e){
// if enter -> launch register
if( e.keyCode === 13 )
this.func.register();
}.bind(gs.get.register);

View File

@ -7,9 +7,9 @@
<div class='form'>
<h3>Welcome back!</h3>
<label for='username' :class='gs.login.username.error.length<1?``:`err`'>USERNAME <span>{{ gs.login.username.error }}</span></label>
<input type='text' name='username' v-model='gs.login.username.model' class='flat' autofocus>
<input @keyup='gs.login.func.press_enter' type='text' name='username' v-model='gs.login.username.model' class='flat' autofocus>
<label for='password' :class='gs.login.password.error.length<1?``:`err`'>PASSWORD <span>{{ gs.login.password.error }}</span></label>
<input type='password' name='password' v-model='gs.login.password.model' class='flat'>
<input @keyup='gs.login.func.press_enter' type='password' name='password' v-model='gs.login.password.model' class='flat'>
<!-- <label for='fpass' class='link' @click='gs.login.func.forgot_pass()'>FORGOT YOUR PASSWORD ?</label> -->
<button class='submit' @click='gs.login.func.login()'>Login</button>

View File

@ -7,11 +7,11 @@
<div class='form'>
<h3>Create an account</h3>
<label for='mail' :class='gs.register.mail.error.length<1?``:`err`'>EMAIL <span>{{ gs.register.mail.error }}</span></label>
<input type='email' name='mail' v-model='gs.register.mail.model' class='flat' autofocus>
<input @keyup='gs.register.func.press_enter' type='email' name='mail' v-model='gs.register.mail.model' class='flat' autofocus>
<label for='username' :class='gs.register.username.error.length<1?``:`err`'>USERNAME <span>{{ gs.register.username.error }}</span></label>
<input type='text' name='username' v-model='gs.register.username.model' class='flat'>
<input @keyup='gs.register.func.press_enter' type='text' name='username' v-model='gs.register.username.model' class='flat'>
<label for='password' :class='gs.register.password.error.length<1?``:`err`'>PASSWORD <span>{{ gs.register.password.error }}</span></label>
<input type='password' name='password' v-model='gs.register.password.model' class='flat'>
<input @keyup='gs.register.func.press_enter' type='password' name='password' v-model='gs.register.password.model' class='flat'>
<button class='submit' @click='gs.register.func.register()'>Continue</button>
<span>By registering, you agree to Discord's <a href='https://discordapp.com/terms'>Terms of Service</a> and <a href='https://discordapp.com/privacy'>Privacy Policy</a></span>