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
f776a1d6
Commit
f776a1d6
authored
Feb 12, 2019
by
Robert Czechowski
Browse files
Db: Add SetPassword trait to change passwords of users
parent
5ee059a5
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/db_conn_sqlite.rs
View file @
f776a1d6
...
...
@@ -847,3 +847,18 @@ impl MedalObject<Connection> for Group {
}
}
}
pub
trait
SetPassword
{
fn
set_password
(
&
mut
self
,
&
str
)
->
Option
<
()
>
;
}
impl
SetPassword
for
SessionUser
{
fn
set_password
(
&
mut
self
,
password
:
&
str
)
->
Option
<
()
>
{
let
salt
=
"blub"
;
let
hash
=
hash_password
(
password
,
salt
);
self
.password
=
Some
(
hash
);
self
.salt
=
Some
(
salt
.into
());
Some
(())
}
}
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