swap out random password method
This commit is contained in:
parent
0b89117225
commit
3c58559763
|
@ -4,25 +4,7 @@
|
|||
import { users } from "stores/portal"
|
||||
|
||||
const [email, error, touched] = createValidationStore("", emailValidator)
|
||||
const password = generatePassword()
|
||||
|
||||
function generatePassword() {
|
||||
return Array(30)
|
||||
.fill(
|
||||
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz~!@-#$"
|
||||
)
|
||||
.map(
|
||||
x =>
|
||||
x[
|
||||
Math.floor(
|
||||
(crypto.getRandomValues(new Uint32Array(1))[0] /
|
||||
(0xffffffff + 1)) *
|
||||
x.length
|
||||
)
|
||||
]
|
||||
)
|
||||
.join("")
|
||||
}
|
||||
const password = Math.random().toString(36).substr(2, 20)
|
||||
|
||||
async function createUser() {
|
||||
const res = await users.create({ email: $email, password })
|
||||
|
|
Loading…
Reference in New Issue