Authentication error reporting
This commit is contained in:
parent
4a3136a766
commit
48a092432c
@ -7,7 +7,7 @@
|
||||
<div class="accordion-body" v-else>
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<p class="card-text row"><code class="col" v-if="banner"><pre>{{banner.join('\n')}}</pre></code><code class="col" v-if="user"><pre>{{user.join('\n')}}</pre></code></p>
|
||||
<p class="card-text row"><code class="col" v-if="banner"><pre>{{banner.join('\n')}}</pre></code><code class="col" v-if="authinfo"><pre v-if="(authinfo.greeting) && (authinfo.greeting.length > 0)">{{authinfo.greeting.join('\n').replace(/^\n+|\s+$/gm, '')}}</pre><pre v-if="user">{{user.join('\n')}}</pre></code></p>
|
||||
</div>
|
||||
<button class="btn btn-danger" style="width: 100%;" type="button" v-if="user" v-on:click="logout">Logout</button>
|
||||
<div class="input-group flex-nowrap" v-if="!user">
|
||||
@ -142,11 +142,22 @@
|
||||
},
|
||||
async login(evt) {
|
||||
if(this.x_client) {
|
||||
try {
|
||||
this.authinfo = await ((this.accesscode && this.verifycode) ? this.x_client.authenticate(this.accesscode + ';' + this.verifycode) : this.x_client.authenticate());
|
||||
if(this.authinfo.duz) {
|
||||
var user = await this.x_client.XUS_GET_USER_INFO();
|
||||
this.x_user = user[0] ? user : null
|
||||
} else this.x_user = null;
|
||||
} else {
|
||||
this.x_user = null;
|
||||
if(this.authinfo.message) window.alert(this.authinfo.message);
|
||||
else window.alert('Authentication failed.');
|
||||
}
|
||||
} catch(ex) {
|
||||
this.authinfo = this.x_user = null;
|
||||
console.warn(ex);
|
||||
if(ex.name) window.alert(ex.name);
|
||||
else window.alert('Authentication failed.');
|
||||
}
|
||||
this.$emit('update:user', this.x_user);
|
||||
this.show = !this.x_user;
|
||||
this.$emit('update:server', this.x_server = (await this.x_client.serverinfo()).result);
|
||||
|
Loading…
Reference in New Issue
Block a user