Commit 9fcbde20 authored by Robert Czechowski's avatar Robert Czechowski
Browse files

Generate logincode for admin account. Fixes #73

parent 96eb98d6
......@@ -130,9 +130,20 @@ fn add_admin_user<C>(conn: &mut C, resetpw: bool)
})
.take(8)
.collect();
print!("'{}' …", &password);
print!("'{}', ", &password);
let logincode: String = thread_rng().sample_iter(&Alphanumeric)
.filter(|x| {
let x = *x;
!(x == 'l' || x == 'I' || x == '1' || x == 'O' || x == 'o' || x == '0')
})
.take(8)
.collect();
let logincode = format!("a{}", logincode);
print!(" logincode:'{}' …", &logincode);
admin.username = Some("admin".into());
admin.logincode = Some(logincode);
match admin.set_password(&password) {
None => println!(" FAILED! (Password hashing error)"),
_ => {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment