44-->
55
66<script setup lang="ts">
7- import { computed , ref , useTemplateRef , watch } from ' vue'
8- import { getBuilder } from ' @nextcloud/browser-storage'
97import { setGuestNickname } from ' @nextcloud/auth'
8+ import { getBuilder } from ' @nextcloud/browser-storage'
109import { showError } from ' @nextcloud/dialogs'
11-
10+ import { computed , ref , useTemplateRef , watch } from ' vue '
1211import NcDialog from ' @nextcloud/vue/components/NcDialog'
1312import NcNoteCard from ' @nextcloud/vue/components/NcNoteCard'
1413import NcTextField from ' @nextcloud/vue/components/NcTextField'
15-
1614import { t } from ' ../utils/l10n.ts'
15+ import { logger } from ' ../utils/logger.ts'
1716
1817export interface PublicAuthPromptProps {
1918 /**
2019 * Preselected nickname.
2120 * No name preselected by default.
2221 */
23- nickname? : string ,
22+ nickname? : string
2423
2524 /**
2625 * Dialog title
@@ -51,10 +50,11 @@ export interface PublicAuthPromptProps {
5150}
5251
5352const props = withDefaults (defineProps <PublicAuthPromptProps >(), {
54- title: t (' Guest identification' ),
5553 nickname: ' ' ,
5654 notice: t (' You are currently not identified.' ),
5755 submitLabel: t (' Submit name' ),
56+ text: ' ' ,
57+ title: t (' Guest identification' ),
5858})
5959
6060const emit = defineEmits <{
@@ -91,6 +91,9 @@ const buttons = computed(() => {
9191 return [submitButton ]
9292})
9393
94+ /**
95+ * Handle saving the nickname and return it.
96+ */
9497function onSubmit() {
9598 const nickname = name .value .trim ()
9699
@@ -113,9 +116,9 @@ function onSubmit() {
113116 try {
114117 // Set the nickname
115118 setGuestNickname (nickname )
116- } catch (e ) {
119+ } catch (error ) {
120+ logger .error (' Failed to set nickname' , { error })
117121 showError (t (' Failed to set nickname.' ))
118- console .error (' Failed to set nickname' , e )
119122 inputElement .value .focus ()
120123 return
121124 }
@@ -142,18 +145,20 @@ function onSubmit() {
142145 </p >
143146
144147 <!-- Header -->
145- <NcNoteCard class =" public-auth-prompt__header"
148+ <NcNoteCard
149+ class =" public-auth-prompt__header"
146150 :text =" notice"
147151 type =" info" />
148152
149153 <!-- Form -->
150- <NcTextField ref =" input"
154+ <NcTextField
155+ ref =" input"
156+ v-model =" name"
151157 class =" public-auth-prompt__input"
152158 data-cy-public-auth-prompt-dialog-name
153159 :label =" t('Name')"
154160 :placeholder =" t('Enter your name')"
155161 :required =" !cancellable"
156- v-model =" name"
157162 minlength =" 2"
158163 name =" name" />
159164 </NcDialog >
0 commit comments