refactor login

refactor login so it's self contained in a single function
will be useful in adding other password based login method such as ldap
This commit is contained in:
Trinity Pointard
2019-07-07 16:24:24 +02:00
parent 54c6d21fc5
commit 7fd1fe6d52
5 changed files with 50 additions and 74 deletions
+2 -10
View File
@@ -109,16 +109,8 @@ fn new<'a>(args: &ArgMatches<'a>, conn: &Connection) {
rpassword::read_password().expect("Couldn't read your password.")
});
NewUser::new_local(
conn,
username,
display_name,
admin,
&bio,
email,
User::hash_pass(&password).expect("Couldn't hash password"),
)
.expect("Couldn't save new user");
NewUser::new_local(conn, username, display_name, admin, &bio, email, &password)
.expect("Couldn't save new user");
}
fn reset_password<'a>(args: &ArgMatches<'a>, conn: &Connection) {