Improve random key generation
This commit is contained in:
parent
77e2108403
commit
5b3e56954e
1 changed files with 3 additions and 4 deletions
|
@ -60,11 +60,10 @@ fn reset_prepare(config: &Ldap0rConfig, keys: &Keys, email_address: &str) -> Res
|
||||||
|
|
||||||
if rs.len() == 1 {
|
if rs.len() == 1 {
|
||||||
// generate key
|
// generate key
|
||||||
let mut key = String::with_capacity(64);
|
|
||||||
let mut rng = rand::thread_rng();
|
let mut rng = rand::thread_rng();
|
||||||
for _ in 0..64 {
|
let key: String = (0..64)
|
||||||
key.push(BASE62[rng.gen::<usize>() % 62] as char);
|
.map(|_| BASE62[rng.gen::<usize>() % 62] as char)
|
||||||
}
|
.collect();
|
||||||
|
|
||||||
// store key with id
|
// store key with id
|
||||||
let keys = Arc::clone(&keys.keys);
|
let keys = Arc::clone(&keys.keys);
|
||||||
|
|
Loading…
Reference in a new issue