From 48a092432cdc305929f0e6bffb9a800f5056e124 Mon Sep 17 00:00:00 2001 From: inportb Date: Mon, 29 May 2023 18:33:34 -0400 Subject: [PATCH] Authentication error reporting --- htdocs/Login.vue | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/htdocs/Login.vue b/htdocs/Login.vue index f5ef20f..35ad857 100644 --- a/htdocs/Login.vue +++ b/htdocs/Login.vue @@ -7,7 +7,7 @@
-

{{banner.join('\n')}}
{{user.join('\n')}}

+

{{banner.join('\n')}}
{{authinfo.greeting.join('\n').replace(/^\n+|\s+$/gm, '')}}
{{user.join('\n')}}

@@ -142,11 +142,22 @@ }, async login(evt) { if(this.x_client) { - 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; + 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; + 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);