aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/src/public-file-request.ts
diff options
context:
space:
mode:
authorskjnldsv <skjnldsv@protonmail.com>2024-07-17 16:48:47 +0200
committerskjnldsv <skjnldsv@protonmail.com>2024-07-18 20:15:39 +0200
commitf28d933acc2d97021c69be79c7f2238cbaac419f (patch)
treed5fe8eceb005d3d72d236abb4bc1c29be4273d25 /apps/files_sharing/src/public-file-request.ts
parentf45d6135d7f707d34017312e975137c645d202c7 (diff)
downloadnextcloud-server-f28d933acc2d97021c69be79c7f2238cbaac419f.tar.gz
nextcloud-server-f28d933acc2d97021c69be79c7f2238cbaac419f.zip
feat(files_sharing): add public name prompt for files requests
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files_sharing/src/public-file-request.ts')
-rw-r--r--apps/files_sharing/src/public-file-request.ts23
1 files changed, 23 insertions, 0 deletions
diff --git a/apps/files_sharing/src/public-file-request.ts b/apps/files_sharing/src/public-file-request.ts
new file mode 100644
index 00000000000..763c4f60624
--- /dev/null
+++ b/apps/files_sharing/src/public-file-request.ts
@@ -0,0 +1,23 @@
+/**
+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+import { spawnDialog } from '@nextcloud/dialogs'
+import { defineAsyncComponent } from 'vue'
+import logger from './services/logger'
+
+const nick = localStorage.getItem('nick')
+const publicAuthPromptShown = localStorage.getItem('publicAuthPromptShown')
+
+// If we don't have a nickname or the public auth prompt hasn't been shown yet, show it
+// We still show the prompt if the user has a nickname to double check
+if (!nick || !publicAuthPromptShown) {
+ spawnDialog(
+ defineAsyncComponent(() => import('./views/PublicAuthPrompt.vue')),
+ {},
+ () => localStorage.setItem('publicAuthPromptShown', 'true'),
+ )
+} else {
+ logger.debug(`Public auth prompt already shown. Current nickname is '${nick}'`)
+}