1
1
<template >
2
- <NcModal size =" normal" @close =" close" >
3
- <NcContent class =" modal-view" >
4
- <template slot="header">
5
- <h2 >{{ t('libresign', 'Sign with your cellphone number.') }}</h2 >
6
- <!-- <p>{{ t('libresign', 'Sign the document.') }}</p> -->
7
- </template >
8
-
9
- <div v-if =" newPhoneNumber" class =" code-request" >
10
- <h3 class =" phone" >
11
- {{ newPhoneNumber }}
12
- </h3 >
13
-
14
- <div v-if =" tokenRequested" >
15
- <input v-model =" token"
16
- :disabled =" loading"
17
- name =" code"
18
- type =" text" >
19
- </div >
20
-
21
- <div >
22
- <button v-if =" !tokenRequested" :disabled =" loading" @click =" requestCode" >
23
- {{ t('libresign', 'Request code.') }}
24
- </button >
25
-
26
- <button v-if =" tokenRequested" :disabled =" loading" @click =" sendCode" >
27
- {{ t('libresign', 'Send code.') }}
28
- </button >
29
- </div >
30
- </div >
31
- <div v-else class =" store-number" >
32
- <div >
33
- <input v-model =" newPhoneNumber"
34
- :disabled =" loading"
35
- name =" cellphone"
36
- placeholder =" +55 00 0 0000 0000"
37
- type =" tel"
38
- @change =" sanitizeNumber" >
39
- </div >
40
-
41
- <div >
42
- <button :disabled =" loading || newPhoneNumber.length < 10" @click =" saveNumber" >
43
- {{ t('libresign', 'Save your number.') }}
44
- </button >
45
- </div >
46
- </div >
47
- </NcContent >
48
- </NcModal >
2
+ <NcDialog v-if =" signMethodsStore.modal.sms"
3
+ :name =" t('libresign', 'Sign with your cellphone number.')"
4
+ @closing =" signMethodsStore.closeModal('sms')" >
5
+ <div v-if =" newPhoneNumber" class =" code-request" >
6
+ <h3 class =" phone" >
7
+ {{ newPhoneNumber }}
8
+ </h3 >
9
+
10
+ <NcTextField v-if =" tokenRequested"
11
+ v-model =" token"
12
+ :disabled =" loading"
13
+ name =" code"
14
+ type =" text" >
15
+ </NcTextField >
16
+ </div >
17
+ <div v-else class =" store-number" >
18
+ <NcTextField v-model =" newPhoneNumber"
19
+ :disabled =" loading"
20
+ name =" cellphone"
21
+ placeholder =" +55 00 0 0000 0000"
22
+ type =" tel"
23
+ @change =" sanitizeNumber" >
24
+ </NcTextField >
25
+ </div >
26
+ <template #actions >
27
+ <NcButton v-if =" newPhoneNumber && !tokenRequested" :disabled =" loading" @click =" requestCode" >
28
+ <template #icon >
29
+ <NcLoadingIcon v-if =" loading" :size =" 20" />
30
+ </template >
31
+ {{ t('libresign', 'Request code.') }}
32
+ </NcButton >
33
+ <NcButton v-if =" newPhoneNumber && tokenRequested" :disabled =" loading" @click =" sendCode" >
34
+ <template #icon >
35
+ <NcLoadingIcon v-if =" loading" :size =" 20" />
36
+ </template >
37
+ {{ t('libresign', 'Send code.') }}
38
+ </NcButton >
39
+ <NcButton v-if =" !newPhoneNumber" :disabled =" loading || newPhoneNumber.length < 10" @click =" saveNumber" >
40
+ <template #icon >
41
+ <NcLoadingIcon v-if =" loading" :size =" 20" />
42
+ </template >
43
+ {{ t('libresign', 'Save your number.') }}
44
+ </NcButton >
45
+ </template >
46
+ </NcDialog >
49
47
</template >
50
48
51
49
<script >
50
+ import NcDialog from ' @nextcloud/vue/dist/Components/NcDialog.js'
51
+ import NcButton from ' @nextcloud/vue/dist/Components/NcButton.js'
52
+ import NcLoadingIcon from ' @nextcloud/vue/dist/Components/NcLoadingIcon.js'
53
+ import NcTextField from ' @nextcloud/vue/dist/Components/NcTextField.js'
52
54
import axios from ' @nextcloud/axios'
53
55
import { generateOcsUrl } from ' @nextcloud/router'
54
56
import { confirmPassword } from ' @nextcloud/password-confirmation'
55
- import ' @nextcloud/password-confirmation/dist/style.css' // Required for dialog styles
56
- import NcModal from ' @nextcloud/vue/dist/Components/NcModal.js'
57
57
import { showError , showSuccess } from ' @nextcloud/dialogs'
58
58
import { onError } from ' ../../../helpers/errors.js'
59
59
import { settingsService } from ' ../../../domains/settings/index.js'
@@ -66,7 +66,10 @@ const sanitizeNumber = val => {
66
66
export default {
67
67
name: ' ModalSMSManager' ,
68
68
components: {
69
- NcModal,
69
+ NcDialog,
70
+ NcLoadingIcon,
71
+ NcTextField,
72
+ NcButton,
70
73
},
71
74
props: {
72
75
phoneNumber: {
@@ -163,29 +166,10 @@ h3.phone {
163
166
text-align : center ;
164
167
}
165
168
166
- button {
167
- width : 60% ;
168
- max-width : 200px ;
169
- margin-top : 5px ;
170
- margin-left : auto ;
171
- margin-right : auto ;
172
- display : block ;
173
-
174
- }
175
-
176
169
.code-request , .store-number {
177
170
width : 100% ;
178
171
display : flex ;
179
172
flex-direction : column ;
180
- input {
181
- font-family : monospace ;
182
- font-size : 1.1em ;
183
- width : 50% ;
184
- max-width : 250px ;
185
- height : auto !important ;
186
- display : block ;
187
- margin : 0 auto ;
188
- }
189
173
}
190
174
191
175
.code-request input {
0 commit comments