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>
|
<span><b>n</b>.eko</span>
|
||||||
</div>
|
</div>
|
||||||
<form class="message" v-if="!connecting" @submit.stop.prevent="connect">
|
<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="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">
|
<button type="submit" @click.stop.prevent="login">
|
||||||
{{ $t('connect.connect') }}
|
{{ $t('connect.connect') }}
|
||||||
</button>
|
</button>
|
||||||
@ -158,13 +159,29 @@
|
|||||||
this.$accessor.login({ displayname: this.$accessor.displayname, password: this.$accessor.password })
|
this.$accessor.login({ displayname: this.$accessor.displayname, password: this.$accessor.password })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
get autoPassword() {
|
||||||
|
return new URL(location.href).searchParams.get('pwd')
|
||||||
|
}
|
||||||
|
|
||||||
get connecting() {
|
get connecting() {
|
||||||
return this.$accessor.connecting
|
return this.$accessor.connecting
|
||||||
}
|
}
|
||||||
|
|
||||||
login() {
|
async login() {
|
||||||
this.$accessor.login({ displayname: this.displayname, password: this.password })
|
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>
|
</script>
|
||||||
|
@ -10,10 +10,12 @@ export const side = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const connect = {
|
export const connect = {
|
||||||
title: 'Please Login',
|
login_title: 'Please Login',
|
||||||
displayname: 'Display Name',
|
invitation_title: 'You have been invited to this room',
|
||||||
|
displayname: 'Enter your display name',
|
||||||
password: 'Password',
|
password: 'Password',
|
||||||
connect: 'Connect',
|
connect: 'Connect',
|
||||||
|
error: 'Login error',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const context = {
|
export const context = {
|
||||||
|
@ -52,7 +52,7 @@ export abstract class BaseClient extends EventEmitter<BaseEvents> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (displayname === '') {
|
if (displayname === '') {
|
||||||
throw new Error('Must add a displayname') // TODO: Better handling
|
throw new Error('Display Name cannot be empty.')
|
||||||
}
|
}
|
||||||
|
|
||||||
this._displayname = displayname
|
this._displayname = displayname
|
||||||
|
Loading…
Reference in New Issue
Block a user