Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Access token should be hidden/masked by default in Agent Dashboa…
…rd (#6492) Supports masking/unmasking sensitive data such as API Tokens in the agent dashboard. Fixes: #6322 Co-authored-by: raph941 <45232708+raph941@users.noreply.github.com> Co-authored-by: Nithin David Thomas <1277421+nithindavid@users.noreply.github.com>
- Loading branch information
1 parent
aff97bf
commit b905d48
Showing
3 changed files
with
69 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<template> | ||
<div class="text--container"> | ||
<woot-button size="small" class=" button--text" @click="onCopy"> | ||
{{ $t('COMPONENTS.CODE.BUTTON_TEXT') }} | ||
</woot-button> | ||
<woot-button | ||
variant="clear" | ||
size="small" | ||
class="button--visibility" | ||
color-scheme="secondary" | ||
:icon="masked ? 'eye-show' : 'eye-hide'" | ||
@click.prevent="toggleMasked" | ||
/> | ||
<highlightjs v-if="value" :code="masked ? '•'.repeat(10) : value" /> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import 'highlight.js/styles/default.css'; | ||
import { copyTextToClipboard } from 'shared/helpers/clipboard'; | ||
export default { | ||
props: { | ||
value: { | ||
type: String, | ||
default: '', | ||
}, | ||
}, | ||
data() { | ||
return { | ||
masked: true, | ||
}; | ||
}, | ||
methods: { | ||
async onCopy(e) { | ||
e.preventDefault(); | ||
await copyTextToClipboard(this.value); | ||
bus.$emit('newToastMessage', this.$t('COMPONENTS.CODE.COPY_SUCCESSFUL')); | ||
}, | ||
toggleMasked() { | ||
this.masked = !this.masked; | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
||
<style lang="scss" scoped> | ||
.text--container { | ||
position: relative; | ||
text-align: left; | ||
.button--text, | ||
.button--visibility { | ||
margin-top: 0; | ||
position: absolute; | ||
right: 0; | ||
} | ||
.button--visibility { | ||
right: 60px; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters