Skip to content

Commit 1999598

Browse files
committed
chore: update personal settings basic auth
Signed-off-by: Anupam Kumar <[email protected]>
1 parent dd0ff8e commit 1999598

File tree

1 file changed

+29
-20
lines changed

1 file changed

+29
-20
lines changed

src/components/PersonalSettings.vue

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -49,30 +49,37 @@
4949
{{ t('integration_openai', 'Leave the username and password empty to use the ones defined by your administrator') }}
5050
</NcNoteCard>
5151
<div class="line">
52-
<label for="basic-user">
53-
<KeyOutlineIcon :size="20" class="icon" />
54-
{{ t('integration_openai', 'Username') }}
55-
</label>
56-
<input id="openai-basic-user"
52+
<NcTextField
53+
id="openai-basic-user"
5754
v-model="state.basic_user"
58-
type="text"
55+
class="input"
5956
:readonly="readonly"
60-
:placeholder="t('integration_openai', 'your Basic Auth user')"
61-
@input="onSensitiveInput"
57+
:label="t('integration_openai', 'Basic Auth user')"
58+
:show-trailing-button="!!state.basic_user"
59+
@update:model-value="onSensitiveInput()"
60+
@trailing-button-click="state.basic_user = '' ; onSensitiveInput()"
6261
@focus="readonly = false">
62+
<template #icon>
63+
<AccountOutlineIcon :size="20" />
64+
</template>
65+
</NcTextField>
6366
</div>
6467
<div class="line">
65-
<label for="basic-password">
66-
<KeyOutlineIcon :size="20" class="icon" />
67-
{{ t('integration_openai', 'Password') }}
68-
</label>
69-
<input id="openai-basic-password"
68+
<NcTextField
69+
id="openai-basic-password"
7070
v-model="state.basic_password"
71+
class="input"
7172
type="password"
7273
:readonly="readonly"
73-
:placeholder="t('integration_openai', 'your Basic Auth password')"
74-
@input="onSensitiveInput"
74+
:label="t('integration_openai', 'Basic Auth password')"
75+
:show-trailing-button="!!state.basic_password"
76+
@update:model-value="onSensitiveInput()"
77+
@trailing-button-click="state.basic_password = '' ; onSensitiveInput()"
7578
@focus="readonly = false">
79+
<template #icon>
80+
<KeyOutlineIcon :size="20" />
81+
</template>
82+
</NcTextField>
7683
</div>
7784
</div>
7885
<div v-if="quotaInfo !== null">
@@ -113,6 +120,7 @@
113120
</template>
114121

115122
<script>
123+
import AccountOutlineIcon from 'vue-material-design-icons/AccountOutline.vue'
116124
import InformationOutlineIcon from 'vue-material-design-icons/InformationOutline.vue'
117125
import KeyOutlineIcon from 'vue-material-design-icons/KeyOutline.vue'
118126
@@ -132,6 +140,7 @@ export default {
132140
name: 'PersonalSettings',
133141
134142
components: {
143+
AccountOutlineIcon,
135144
OpenAiIcon,
136145
KeyOutlineIcon,
137146
InformationOutlineIcon,
@@ -167,17 +176,17 @@ export default {
167176
this.saveOptions({
168177
})
169178
}, 2000),
170-
onSensitiveInput: debounce(function() {
179+
onSensitiveInput: debounce(async function() {
171180
const values = {
172-
basic_user: this.state.basic_user,
181+
basic_user: (this.state.basic_user ?? '').trim(),
173182
}
174183
if (this.state.api_key !== 'dummyApiKey') {
175-
values.api_key = this.state.api_key
184+
values.api_key = (this.state.api_key ?? '').trim()
176185
}
177186
if (this.state.basic_password !== 'dummyPassword') {
178-
values.basic_password = this.state.basic_password
187+
values.basic_password = (this.state.basic_password ?? '').trim()
179188
}
180-
this.saveOptions(values, true)
189+
await this.saveOptions(values, true)
181190
}, 2000),
182191
async loadQuotaInfo() {
183192
const url = generateUrl('/apps/integration_openai/quota-info')

0 commit comments

Comments
 (0)