feat: setup game and create admin user
This commit is contained in:
parent
846f137b7a
commit
a78ed70f05
@ -15,7 +15,7 @@
|
|||||||
<div class="page-setup__auth-message">{{ $t('remember-and-log-in') }}</div>
|
<div class="page-setup__auth-message">{{ $t('remember-and-log-in') }}</div>
|
||||||
<template v-slot:footer>
|
<template v-slot:footer>
|
||||||
<div class="page-setup__cta">
|
<div class="page-setup__cta">
|
||||||
<Button @click="createAdminAccount">{{ $t('complete-setup') }}</Button>
|
<Button @click="createAdminAccount" :disabled="saveInProgress">{{ $t('complete-setup') }}</Button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</ModalDialog>
|
</ModalDialog>
|
||||||
@ -43,6 +43,7 @@ const { $t } = useI18n({
|
|||||||
await useAuth().authenticateAndLoadUserInfo(['setup'])
|
await useAuth().authenticateAndLoadUserInfo(['setup'])
|
||||||
|
|
||||||
const showAdminAccountCreatedDialog = ref(false)
|
const showAdminAccountCreatedDialog = ref(false)
|
||||||
|
const saveInProgress = ref(false)
|
||||||
const authcode = ref('000000')
|
const authcode = ref('000000')
|
||||||
const openModal = () => {
|
const openModal = () => {
|
||||||
authcode.value = ''
|
authcode.value = ''
|
||||||
@ -50,10 +51,15 @@ const openModal = () => {
|
|||||||
authcode.value += '' + Math.floor(Math.floor(Math.random() * 10000) / 100) % 10
|
authcode.value += '' + Math.floor(Math.floor(Math.random() * 10000) / 100) % 10
|
||||||
}
|
}
|
||||||
showAdminAccountCreatedDialog.value = true
|
showAdminAccountCreatedDialog.value = true
|
||||||
|
saveInProgress.value = false
|
||||||
}
|
}
|
||||||
|
|
||||||
const createAdminAccount = () => {
|
const createAdminAccount = async () => {
|
||||||
useEngine().setupApp(authcode.value)
|
saveInProgress.value = true
|
||||||
|
await useEngine().setupApp(authcode.value)
|
||||||
|
saveInProgress.value = false
|
||||||
|
showAdminAccountCreatedDialog.value = false
|
||||||
|
document.location.pathname = "/"
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -32,6 +32,10 @@ func (app *Application) createUser(gm *game.Game, name, role, authcode string) (
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
app.users[newUser.GetId()] = newUser
|
app.users[newUser.GetId()] = newUser
|
||||||
|
|
||||||
|
if gm != nil {
|
||||||
gm.AddPlayer(newUser)
|
gm.AddPlayer(newUser)
|
||||||
|
}
|
||||||
|
|
||||||
return newUser.GetId(), nil
|
return newUser.GetId(), nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user