Skip to content

Commit

Permalink
fix: Add an option to view the masked information in the profile sett…
Browse files Browse the repository at this point in the history
…ings UI (chatwoot#9343)
  • Loading branch information
muhsin-k authored May 2, 2024
1 parent 5846ee4 commit 3488a31
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<span v-if="error" class="message">
{{ error }}
</span>
<slot name="masked" />
</label>
</template>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,25 @@
<div class="flex flex-row justify-between gap-4">
<woot-input
name="access_token"
class="flex-1 focus:[&>input]:!border-slate-200 focus:[&>input]:dark:!border-slate-600 [&>input]:cursor-not-allowed"
class="flex-1 [&>input]:!py-1.5 ltr:[&>input]:!pr-9 ltr:[&>input]:!pl-3 rtl:[&>input]:!pl-9 rtl:[&>input]:!pr-3 focus:[&>input]:!border-slate-200 focus:[&>input]:dark:!border-slate-600 [&>input]:cursor-not-allowed relative"
:styles="{
borderRadius: '12px',
padding: '6px 12px',
fontSize: '14px',
marginBottom: '2px',
}"
type="password"
:type="inputType"
:value="value"
readonly
/>
>
<template #masked>
<button
class="absolute top-1.5 ltr:right-0.5 rtl:left-0.5"
@click="toggleMasked"
>
<fluent-icon :icon="maskIcon" :size="16" />
</button>
</template>
</woot-input>
<form-button
type="submit"
size="large"
Expand All @@ -26,6 +34,7 @@
</div>
</template>
<script setup>
import { ref, computed } from 'vue';
import FormButton from 'v3/components/Form/Button.vue';
const props = defineProps({
value: {
Expand All @@ -34,6 +43,15 @@ const props = defineProps({
},
});
const emit = defineEmits(['on-copy']);
const inputType = ref('password');
const toggleMasked = () => {
inputType.value = inputType.value === 'password' ? 'text' : 'password';
};
const maskIcon = computed(() => {
return inputType.value === 'password' ? 'eye-hide' : 'eye-show';
});
const onClick = () => {
emit('on-copy', props.value);
};
Expand Down
Loading

0 comments on commit 3488a31

Please sign in to comment.