Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bwinf
medal
Commits
2b5b5a67
Commit
2b5b5a67
authored
Feb 12, 2019
by
Robert Czechowski
Browse files
Use SetPassword trait in creation of admin user
parent
f776a1d6
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main.rs
View file @
2b5b5a67
...
...
@@ -29,6 +29,7 @@ mod db_conn_sqlite;
mod
db_conn
;
mod
db_objects
;
use
db_conn_sqlite
::
SetPassword
;
// TODO: Refactor, so we don't need to take this from there!
use
db_conn
::{
MedalConnection
,
MedalObject
};
use
db_objects
::
*
;
...
...
@@ -156,10 +157,13 @@ fn add_admin_user(conn: &mut Connection) {
print!
(
"New Database. Creating new admin user with credentials 'admin':'test' … "
);
let
mut
admin
=
conn
.new_session
();
admin
.username
=
Some
(
"admin"
.into
());
admin
.password
=
Some
(
"test"
.into
());
admin
.salt
=
Some
(
""
.into
());
conn
.save_session
(
admin
);
println!
(
"Done"
);
match
admin
.set_password
(
"test"
)
{
None
=>
println!
(
"FAILED! (Password hashing error)"
),
_
=>
{
conn
.save_session
(
admin
);
println!
(
"Done"
);
}
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment