Преглед изворни кода

Add /me verification

pull/5/head
Svitlana пре 4 година
родитељ
комит
8272ec5c6a
1 измењених фајлова са 14 додато и 15 уклоњено
  1. +14
    -15
      src/account/AppLoginPage.vue

+ 14
- 15
src/account/AppLoginPage.vue Прегледај датотеку

@@ -3,10 +3,9 @@
<div>
<div>
<hr/>
<router-link :to="linkPrefix+'/me'">{{messages.link_label_account}}</router-link>
<div @click="checkMeSession">{{messages.link_label_account}}</div>
<hr/>
<router-link :to="linkPrefix+'/'">{{messages.link_label_bubble}}</router-link>
<router-view></router-view>
</div>
</div>
</template>
@@ -32,9 +31,9 @@
created () {
linkPrefix = this.$route.path;
if (user !== null && (typeof user.token !== 'undefined' && user.token !== null)) {
if (this.$route.path !== '' || this.$route.path !== '/'){
if (this.$route.path === '/applogin') {
this.$route.path = '/';
if (linkPrefix !== '' || linkPrefix !== '/'){
if (linkPrefix === '/applogin') {
linkPrefix = '/';
} else {
console.warn('AppLoginPage.created: route path is not empty, sending to login page');
this.$router.push('/login');
@@ -47,18 +46,18 @@
return;
}
},
beforeRouteUpdate (to, from, next) {
// TODO add /me verification

if (user !== null && (typeof user.token !== 'undefined' && user.token !== null)) {
next();
} else {
next('/login');
}
},
methods: {
...mapActions('account', ['checkSession', 'validateAccount']),
...mapActions('system', ['loadSystemConfigs', 'loadMessages'])
...mapActions('system', ['loadSystemConfigs', 'loadMessages']),
checkMeSession () {
const user = util.currentUser();
if (user !== null && (typeof user.token !== 'undefined' && user.token !== null)) {
this.checkSession({messages: this.messages, errors: this.errors});
this.$router.push('/me');
} else {
this.$router.push('/login');
}
},
},
watch: {
user (u) {


Loading…
Откажи
Сачувај