upd: build.router.controller (add _SERVER.session.connected)
upd: public_html.header = (add icon logout) upd: public_html.signup-form (add backlink to login) upd: view.vue.header = (change icon if connected or not) upd: view.vue.signup-form = (add backling to login)
This commit is contained in:
parent
f856b67f7e
commit
438607a1e6
|
@ -26,7 +26,8 @@
|
|||
echo "window._SERVER = ".json_encode([
|
||||
|
||||
'session' => [
|
||||
'name' => $_SESSION['NAME']
|
||||
'name' => $_SESSION['NAME'],
|
||||
'connected' => count($_SESSION['ADMIN']) + count($_SESSION['USER']) > 0
|
||||
]
|
||||
|
||||
])."\n";
|
||||
|
|
|
@ -116,6 +116,7 @@
|
|||
#header-notif .hnotif.search{ background-image: url('/image/header/notif/search.svg@aaaaaa'); }
|
||||
#header-notif .hnotif.menu{ background-image: url('/image/header/notif/menu.svg@aaaaaa'); }
|
||||
#header-notif .hnotif.login{ background-image: url('/image/header/notif/login.svg@aaaaaa'); }
|
||||
#header-notif .hnotif.logout{ background-image: url('/image/header/notif/logout.svg@aaaaaa'); }
|
||||
|
||||
/* HOVER */
|
||||
#header-notif .hnotif:hover{
|
||||
|
@ -129,6 +130,7 @@
|
|||
#header-notif .hnotif.search:hover{ background-image: url('/image/header/notif/search.svg@ae51da'); }
|
||||
#header-notif .hnotif.menu:hover{ background-image: url('/image/header/notif/menu.svg@4a8ad8'); }
|
||||
#header-notif .hnotif.login:hover{ background-image: url('/image/header/notif/login.svg@660088'); }
|
||||
#header-notif .hnotif.logout:hover{ background-image: url('/image/header/notif/logout.svg@660088'); }
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -107,3 +107,10 @@
|
|||
border-width: 1px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
#SIGNUP-FORM > .body > form > #membre{
|
||||
font-size: 0.8em;
|
||||
color: #006eff;
|
||||
text-decoration: underline;
|
||||
margin-top: 8px;
|
||||
}
|
|
@ -13,7 +13,8 @@
|
|||
<!-- Header Notif -->
|
||||
<div id='header-notif'>
|
||||
<div v-for='(notif, link) in gstore.notif' @click='show_notif(link)' :class='"hnotif " + notif.class' :data-count='notif.count'></div>
|
||||
<div @click='show_login()' class='hnotif login'></div>
|
||||
<div v-if='!is_connected' @click='show_login()' class='hnotif login'></div>
|
||||
<div v-if='is_connected' @click='logout()' class='hnotif logout'></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@ -24,7 +25,12 @@
|
|||
<script>
|
||||
export default {
|
||||
name: 'HEADER',
|
||||
data(){ return { gstore: gstore.data }; },
|
||||
data(){
|
||||
return {
|
||||
gstore: gstore.data,
|
||||
is_connected: _SERVER.session.connected
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
show_notif(uri){
|
||||
this.gstore.func.nav(this.$router, uri);
|
||||
|
@ -32,6 +38,11 @@ export default {
|
|||
show_login() {
|
||||
this.gstore.signupform = false;
|
||||
this.gstore.loginform = !this.gstore.loginform;
|
||||
},
|
||||
logout() {
|
||||
api.call('DELETE user/logout', null, function() {
|
||||
document.location = '';
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
<input v-model='password_val' type='password' id='password'>
|
||||
<p v-if='err_username || err_mail || err_unknow' id='msg-err'>{{ err_message }}</p>
|
||||
<button id='btn-create-account'>Créer mon compte</button>
|
||||
<p @click='redirect_login' id='membre'>Déjà membre ? Connectez-vous !</p>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
@ -72,9 +73,22 @@
|
|||
}
|
||||
/* (2) Close the sign up form authentication */
|
||||
else {
|
||||
document.location = '';
|
||||
this.infobox._display('Inscription terminée ! Connexion en cours ...', 'info', 3000);
|
||||
|
||||
let request = {
|
||||
username: this.username_val,
|
||||
password: this.password_val
|
||||
};
|
||||
|
||||
api.call("POST user/login", request, function (response) {
|
||||
document.location = '';
|
||||
});
|
||||
}
|
||||
}.bind(this));
|
||||
},
|
||||
redirect_login() {
|
||||
this.gstore.signupform = false;
|
||||
this.gstore.loginform = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue