mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
invite links.
This commit is contained in:
parent
9e64b47dea
commit
d763895665
@ -6,9 +6,10 @@
|
||||
<span><b>n</b>.eko</span>
|
||||
</div>
|
||||
<form class="message" v-if="!connecting" @submit.stop.prevent="connect">
|
||||
<span>{{ $t('connect.title') }}</span>
|
||||
<span v-if="!autoPassword">{{ $t('connect.login_title') }}</span>
|
||||
<span v-else>{{ $t('connect.invitation_title') }}</span>
|
||||
<input type="text" :placeholder="$t('connect.displayname')" v-model="displayname" />
|
||||
<input type="password" :placeholder="$t('connect.password')" v-model="password" />
|
||||
<input type="password" :placeholder="$t('connect.password')" v-model="password" v-if="!autoPassword" />
|
||||
<button type="submit" @click.stop.prevent="login">
|
||||
{{ $t('connect.connect') }}
|
||||
</button>
|
||||
@ -158,13 +159,29 @@
|
||||
this.$accessor.login({ displayname: this.$accessor.displayname, password: this.$accessor.password })
|
||||
}
|
||||
}
|
||||
get autoPassword() {
|
||||
return new URL(location.href).searchParams.get('pwd')
|
||||
}
|
||||
|
||||
get connecting() {
|
||||
return this.$accessor.connecting
|
||||
}
|
||||
|
||||
login() {
|
||||
this.$accessor.login({ displayname: this.displayname, password: this.password })
|
||||
async login() {
|
||||
let password = this.password
|
||||
if (this.autoPassword) {
|
||||
password = this.autoPassword
|
||||
}
|
||||
|
||||
try {
|
||||
await this.$accessor.login({ displayname: this.displayname, password })
|
||||
} catch (err) {
|
||||
this.$swal({
|
||||
title: this.$t('connect.error') as string,
|
||||
text: err.message,
|
||||
icon: 'error',
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -10,10 +10,12 @@ export const side = {
|
||||
}
|
||||
|
||||
export const connect = {
|
||||
title: 'Please Login',
|
||||
displayname: 'Display Name',
|
||||
login_title: 'Please Login',
|
||||
invitation_title: 'You have been invited to this room',
|
||||
displayname: 'Enter your display name',
|
||||
password: 'Password',
|
||||
connect: 'Connect',
|
||||
error: 'Login error',
|
||||
}
|
||||
|
||||
export const context = {
|
||||
|
@ -52,7 +52,7 @@ export abstract class BaseClient extends EventEmitter<BaseEvents> {
|
||||
}
|
||||
|
||||
if (displayname === '') {
|
||||
throw new Error('Must add a displayname') // TODO: Better handling
|
||||
throw new Error('Display Name cannot be empty.')
|
||||
}
|
||||
|
||||
this._displayname = displayname
|
||||
|
Loading…
Reference in New Issue
Block a user