create admin account and show PIN (WIP)
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Settel 2023-01-29 18:19:34 +01:00
parent 0d2ae30b24
commit 6b9394a50a
2 changed files with 17 additions and 3 deletions

View File

@ -22,7 +22,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { onMounted, ref, watch } from 'vue' import { onMounted, ref } from 'vue'
import { PlayerEdit } from '@/composables/engine.d' import { PlayerEdit } from '@/composables/engine.d'
import type { Button } from '@/components/admin/PlayerModal' import type { Button } from '@/components/admin/PlayerModal'

View File

@ -8,6 +8,12 @@
</div> </div>
<div class="page-setup__button"> <div class="page-setup__button">
<Button @click="createAdminAccount">{{ $t('create admin user') }}</Button> <Button @click="createAdminAccount">{{ $t('create admin user') }}</Button>
<ModalDialog v-if="showAdminAccountCreatedDialog" :no-close-button="true" @close="showAdminAccountCreatedDialog = false">
<div class="create-team-dialog__auth-message">{{ $t('pin') }}</div>
<div class="create-team-dialog__pin">{{ authcode }}</div>
<div class="create-team-dialog__auth-message">{{ $t('remember-and-log-in') }}</div>
</ModalDialog>
</div> </div>
</div> </div>
<CopyrightNotice /> <CopyrightNotice />
@ -15,6 +21,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from 'vue'
import useAuth from '@/composables/useAuth' import useAuth from '@/composables/useAuth'
import useI18n from '@/composables/useI18n' import useI18n from '@/composables/useI18n'
@ -30,10 +37,17 @@ const { $t } = useI18n({
}, },
}) })
await useAuth().authenticateAndLoadUserInfo(['setup']) await useAuth().authenticateAndLoadUserInfo(['setup'])
const createAdminAccount = () => {} const showAdminAccountCreatedDialog = ref(false)
const authcode = ref('000000')
const createAdminAccount = () => {
authcode.value = ''
for (var i = 0; i < 6; i++) {
authcode.value += '' + Math.floor(Math.floor(Math.random() * 10000) / 100) % 10
}
showAdminAccountCreatedDialog.value = true
}
</script> </script>
<style lang="scss"> <style lang="scss">