Add htaccess generator tool

This commit is contained in:
2024-10-03 15:34:25 +03:00
parent 3cafa71cab
commit a0ca8d9c68
5 changed files with 96 additions and 0 deletions

View File

@ -0,0 +1,87 @@
<template>
<h2 class="tool-title">.htaccess User Entry Generator</h2>
<hr class="mt-5 mb-5">
<div class="input-group">
<label for="username">Username</label>
<input id="username" class="input" v-model="toolData.username" v-on:keyup="result" type="text">
</div>
<div class="input-group">
<label for="password">Password</label>
<input id="password" class="input" v-model="toolData.password" v-on:keyup="result" type="text">
</div>
<div class="input-group">
<label for="algorithm">Algorithm</label>
<div>
<select id="algorithm" v-model="toolData.algorithm" v-on:change="result">
<option value="MD5">MD5</option>
<option value="SHA1">SHA1</option>
<option value="BCRYPT">BCRYPT</option>
</select>
</div>
</div>
<hr class="mt-5 mb-5">
<div class="input-group">
<label for="result">Result</label>
<MonacoEditor name="result" language="text" :value="toolResult"></MonacoEditor>
</div>
</template>
<script>
import MonacoEditor from "@/components/MonacoEditor.vue";
import bcrypt from 'bcryptjs';
import md5 from 'md5';
import sha1 from 'sha1';
export default {
components: {
MonacoEditor
},
data() {
return {
toolData: {
username: "",
password: "",
algorithm: "BCRYPT",
},
toolResult: "",
};
},
mounted() {
this.result();
},
methods: {
result() {
if (!(this.toolData.username && this.toolData.password)) {
this.toolResult = '';
return;
}
let encryptedPassword = '';
switch (this.toolData.algorithm) {
case 'MD5':
encryptedPassword = md5(this.toolData.password);
break;
case 'SHA1':
encryptedPassword = sha1(this.toolData.password);
break;
case 'BCRYPT':
encryptedPassword = bcrypt.hashSync(this.toolData.password, 10); // 10 salt rounds
break;
}
this.toolResult = `${this.toolData.username}:${encryptedPassword}`;
}
}
};
</script>
<style lang="scss">
</style>