Added strong user ID generation that works in tor browser
This commit is contained in:
parent
948aef47c1
commit
59ea100c08
@ -100,7 +100,7 @@ __ __ _____ __ __ _____
|
||||
<input type="password" v-model="userIDInput" placeholder="Enter your account ID" required>
|
||||
|
||||
<button @submit.prevent="onSubmit" @click="userID = userIDInput; userLogin()">Login</button>
|
||||
<button @submit.prevent="onSubmit" @click="userID = (crypto.randomUUID().substring(6) + crypto.randomUUID().substring(30)).replaceAll('-',''); userLogin()">Generate Account</button>
|
||||
<button @submit.prevent="onSubmit" @click="userID = randomID(); userLogin()">Generate Account</button>
|
||||
</form>
|
||||
</div>
|
||||
<br><br>
|
||||
|
9
main.js
9
main.js
@ -3,7 +3,14 @@ const { createApp } = Vue
|
||||
|
||||
let app = createApp({
|
||||
computed: {
|
||||
crypto: () => window.crypto,
|
||||
randomID: () => {
|
||||
let buf2hex = function(buffer) { // buffer is an ArrayBuffer
|
||||
return [...new Uint8Array(buffer)]
|
||||
.map(x => x.toString(16).padStart(2, '0'))
|
||||
.join('');
|
||||
}
|
||||
return buf2hex(window.crypto.getRandomValues(new Uint8Array(25)))
|
||||
},
|
||||
onLine: () => window.navigator.onLine
|
||||
},
|
||||
data() {
|
||||
|
Loading…
Reference in New Issue
Block a user