Skip to content

Commit

Permalink
fix: migrate NcPasswordField to v-model usage
Browse files Browse the repository at this point in the history
Signed-off-by: Maksim Sukharev <[email protected]>
  • Loading branch information
Antreesy committed Dec 27, 2024
1 parent 20ef8fe commit 777fd05
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 21 deletions.
11 changes: 3 additions & 8 deletions src/components/AdminSettings/RecordingServers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@
{{ t('spreed', 'Add a new recording backend server') }}
</NcButton>

<NcPasswordField class="form__textfield additional-top-margin"
:value="secret"
<NcPasswordField v-model="secret"
class="form__textfield additional-top-margin"
name="recording_secret"
as-text
:disabled="loading"
:placeholder="t('spreed', 'Shared secret')"
:label="t('spreed', 'Shared secret')"
label-visible
@update:value="updateSecret" />
@update:model-value="debounceUpdateServers" />

<template v-if="servers.length && recordingConsentCapability">
<h3>{{ t('spreed', 'Recording consent') }}</h3>
Expand Down Expand Up @@ -203,11 +203,6 @@ export default {
})
},

updateSecret(value) {
this.secret = value
this.debounceUpdateServers()
},

async updateServers() {
this.loading = true

Expand Down
2 changes: 1 addition & 1 deletion src/components/AdminSettings/SIPBridge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
{{ t('spreed', 'Shared secret') }}
</label>
<NcPasswordField id="sip-shared-secret"
:value.sync="sharedSecret"
v-model="sharedSecret"
class="form"
name="sip-shared-secret"
as-text
Expand Down
11 changes: 3 additions & 8 deletions src/components/AdminSettings/SignalingServers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@
</NcCheckboxRadioSwitch>
</template>

<NcPasswordField class="form__textfield additional-top-margin"
:value="secret"
<NcPasswordField v-model="secret"
class="form__textfield additional-top-margin"
name="signaling_secret"
as-text
:disabled="loading"
:placeholder="t('spreed', 'Shared secret')"
:label="t('spreed', 'Shared secret')"
label-visible
@update:value="updateSecret" />
@update:model-value="debounceUpdateServers" />
</section>
</template>

Expand Down Expand Up @@ -150,11 +150,6 @@ export default {
})
},

updateSecret(value) {
this.secret = value
this.debounceUpdateServers()
},

async updateServers() {
this.loading = true

Expand Down
13 changes: 10 additions & 3 deletions src/components/AdminSettings/TurnServer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,13 @@
@update:value="updateServer" />

<NcPasswordField ref="turn_secret"
v-model="turnSecret"
name="turn_secret"
as-text
placeholder="secret"
class="turn-server__textfield"
:value="secret"
:disabled="loading"
:label="t('spreed', 'TURN server secret')"
@update:value="updateSecret" />
:label="t('spreed', 'TURN server secret')" />

<NcSelect class="turn-server__select"
name="turn_protocols"
Expand Down Expand Up @@ -153,6 +152,14 @@ export default {
},

computed: {
turnSecret: {
get() {
return this.secret
},
set(value) {
this.updateSecret(value)
},
},
turnServerError() {
if (this.schemes.includes('turns') && /^(?:\d{1,3}\.){3}\d{1,3}(?::\d{1,5})?$/.test(this.server.trim())) {
return t('spreed', '{schema} scheme must be used with a domain', { schema: 'turns:' })
Expand Down
2 changes: 1 addition & 1 deletion src/components/ConversationSettings/LinkShareSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

<form v-if="showPasswordField" class="password-form" @submit.prevent="handleSetNewPassword">
<NcPasswordField ref="passwordField"
:value.sync="password"
v-model="password"
autocomplete="new-password"
check-password-strength
:disabled="isSaving"
Expand Down

0 comments on commit 777fd05

Please sign in to comment.