Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bwinf
medal
Commits
9fcbde20
Commit
9fcbde20
authored
May 14, 2020
by
Robert Czechowski
Browse files
Generate logincode for admin account. Fixes
#73
parent
96eb98d6
Changes
1
Show whitespace changes
Inline
Side-by-side
src/main.rs
View file @
9fcbde20
...
...
@@ -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)"
),
_
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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