aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_external/src/views/CredentialsDialog.vue
blob: c9a9539f0616481871f620281ea601828c516039 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<!--
  - SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
  - SPDX-License-Identifier: AGPL-3.0-or-later
-->

<template>
	<NcDialog :buttons="dialogButtons"
		class="external-storage-auth"
		close-on-click-outside
		data-cy-external-storage-auth
		is-form
		:name="t('files_external', 'Storage credentials')"
		out-transition
		@submit="$emit('close', {login, password})"
		@update:open="$emit('close')">
		<!-- Header -->
		<NcNoteCard class="external-storage-auth__header"
			:text="t('files_external', 'To access the storage, you need to provide the authentification informations.')"
			type="info" />

		<!-- Login -->
		<NcTextField ref="login"
			class="external-storage-auth__login"
			data-cy-external-storage-auth-dialog-login
			:label="t('files_external', 'Login')"
			:placeholder="t('files_external', 'Enter the storage login')"
			minlength="2"
			name="login"
			required
			:value.sync="login" />

		<!-- Password -->
		<NcPasswordField ref="password"
			class="external-storage-auth__password"
			data-cy-external-storage-auth-dialog-password
			:label="t('files_external', 'Password')"
			:placeholder="t('files_external', 'Enter the storage password')"
			name="password"
			required
			:value.sync="password" />
	</NcDialog>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
import { t } from '@nextcloud/l10n'

import NcDialog from '@nextcloud/vue/dist/Components/NcDialog.js'
import NcNoteCard from '@nextcloud/vue/dist/Components/NcNoteCard.js'
import NcPasswordField from '@nextcloud/vue/dist/Components/NcPasswordField.js'
import NcTextField from '@nextcloud/vue/dist/Components/NcTextField.js'

export default defineComponent({
	name: 'CredentialsDialog',

	components: {
		NcDialog,
		NcNoteCard,
		NcTextField,
		NcPasswordField,
	},

	setup() {
		return {
			t,
		}
	},

	data() {
		return {
			login: '',
			password: '',
		}
	},

	computed: {
		dialogButtons() {
			return [{
				label: t('files_external', 'Submit'),
				type: 'primary',
				nativeType: 'submit',
			}]
		},
	},
})
</script>