mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-04 13:29:13 -04:00
feat(htpasswd generator): allow salt rounds input (if bcrypt)
This commit is contained in:
parent
3a0b612239
commit
3b7b0a45e6
1 changed files with 6 additions and 1 deletions
|
@ -6,6 +6,7 @@ import TextareaCopyable from '@/components/TextareaCopyable.vue';
|
|||
const username = ref('');
|
||||
const password = ref('');
|
||||
const hashMethod = ref('bcrypt');
|
||||
const saltCount = ref(10);
|
||||
|
||||
const htpasswd = computed(() => {
|
||||
if (username.value === '' || password.value === '') {
|
||||
|
@ -16,7 +17,7 @@ const htpasswd = computed(() => {
|
|||
hash = md5(password.value);
|
||||
}
|
||||
else {
|
||||
hash = hashSync(password.value, 10);
|
||||
hash = hashSync(password.value, saltCount.value);
|
||||
}
|
||||
return `${username.value}:${hash}`;
|
||||
});
|
||||
|
@ -46,6 +47,10 @@ const htpasswd = computed(() => {
|
|||
:options="['bcrypt', 'md5']"
|
||||
/>
|
||||
|
||||
<n-form-item v-if="hashMethod === 'bcrypt'" label="Salt count: " label-placement="left" label-width="120">
|
||||
<n-input-number v-model:value="saltCount" placeholder="Salt rounds..." :max="100" :min="0" w-full />
|
||||
</n-form-item>
|
||||
|
||||
<n-divider />
|
||||
|
||||
<n-form-item label="htpasswd content:">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue