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
3b7dd4c6
Commit
3b7dd4c6
authored
Jan 14, 2020
by
Robert Czechowski
Browse files
Remove to_string() after concat()
parent
96e36f03
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/helpers.rs
View file @
3b7dd4c6
...
...
@@ -34,7 +34,7 @@ pub fn make_login_code() -> String {
}
pub
fn
hash_password
(
password
:
&
str
,
salt
:
&
str
)
->
Result
<
String
,
MedalError
>
{
let
password_and_salt
=
[
password
,
salt
]
.concat
()
.to_string
()
;
let
password_and_salt
=
[
password
,
salt
]
.concat
();
match
bcrypt
::
hash
(
password_and_salt
,
5
)
{
Ok
(
result
)
=>
Ok
(
result
),
Err
(
_
)
=>
Err
(
MedalError
::
PasswordHashingError
),
...
...
@@ -42,7 +42,7 @@ pub fn hash_password(password: &str, salt: &str) -> Result<String, MedalError> {
}
pub
fn
verify_password
(
password
:
&
str
,
salt
:
&
str
,
password_hash
:
&
str
)
->
bool
{
let
password_and_salt
=
[
password
,
salt
]
.concat
()
.to_string
()
;
let
password_and_salt
=
[
password
,
salt
]
.concat
();
match
bcrypt
::
verify
(
password_and_salt
,
password_hash
)
{
Ok
(
result
)
=>
result
,
_
=>
false
,
...
...
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