Skip to content

Commit d7a7728

Browse files
refactor(sign): use ModalVerificationCode instead of separate modals
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 0be6e1f commit d7a7728

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

src/views/SignPDF/_partials/Sign.vue

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,14 @@
144144
:useModal="true"
145145
:errors="signStore.errors"
146146
@certificate:uploaded="onSignatureFileCreated" />
147-
<TokenManager v-if="signMethodsStore.modal.token"
147+
<ModalVerificationCode v-if="signMethodsStore.modal.token"
148+
mode="token"
148149
:phone-number="user?.account?.phoneNumber || ''"
149150
@change="signWithTokenCode"
150151
@update:phone="val => $emit('update:phone', val)"
151152
@close="signMethodsStore.closeModal('token')" />
152-
<EmailManager v-if="signMethodsStore.modal.emailToken"
153+
<ModalVerificationCode v-if="signMethodsStore.modal.emailToken"
154+
mode="email"
153155
@change="signWithEmailToken"
154156
@close="signMethodsStore.closeModal('emailToken')" />
155157
</div>
@@ -172,8 +174,7 @@ import NcNoteCard from '@nextcloud/vue/components/NcNoteCard'
172174
import NcPasswordField from '@nextcloud/vue/components/NcPasswordField'
173175
import NcRichText from '@nextcloud/vue/components/NcRichText'
174176
175-
import EmailManager from './ModalEmailManager.vue'
176-
import TokenManager from './ModalTokenManager.vue'
177+
import ModalVerificationCode from './ModalVerificationCode.vue'
177178
import Draw from '../../../components/Draw/Draw.vue'
178179
import Documents from '../../../views/Account/partials/Documents.vue'
179180
import Signatures from '../../../views/Account/partials/Signatures.vue'
@@ -201,8 +202,7 @@ export default {
201202
NcPasswordField,
202203
NcRichText,
203204
CreatePassword,
204-
TokenManager,
205-
EmailManager,
205+
ModalVerificationCode,
206206
UploadCertificate,
207207
Documents,
208208
Signatures,
@@ -439,12 +439,14 @@ export default {
439439
440440
await this.submitSignature({
441441
method: identifyMethod,
442+
modalCode: 'token',
442443
token,
443444
})
444445
},
445446
async signWithEmailToken() {
446447
await this.submitSignature({
447448
method: this.signMethodsStore.settings.emailToken.identifyMethod,
449+
modalCode: 'emailToken',
448450
token: this.signMethodsStore.settings.emailToken.token,
449451
})
450452
},
@@ -485,13 +487,13 @@ export default {
485487
)
486488
487489
if (result.status === 'signingInProgress') {
488-
this.actionHandler.closeModal(methodConfig.method)
490+
this.actionHandler.closeModal(methodConfig.modalCode || methodConfig.method)
489491
this.$emit('signing-started', {
490492
signRequestUuid: this.signRequestUuid,
491493
async: true,
492494
})
493495
} else if (result.status === 'signed') {
494-
this.actionHandler.closeModal(methodConfig.method)
496+
this.actionHandler.closeModal(methodConfig.modalCode || methodConfig.method)
495497
this.sidebarStore.hideSidebar()
496498
this.$emit('signed', {
497499
...result.data,

0 commit comments

Comments
 (0)