user role
This commit is contained in:
parent
e3a0d4075f
commit
74b32003d0
2 changed files with 5 additions and 4 deletions
|
@ -60,14 +60,14 @@ impl User {
|
|||
Some(u)
|
||||
}
|
||||
|
||||
pub async fn login(username: &str, password: &str) -> Option<Session> {
|
||||
pub async fn login(username: &str, password: &str) -> Option<(Session, UserRole)> {
|
||||
let u = User::find_one(doc! { "username": username }).await?;
|
||||
|
||||
if !u.verify_pw(password) {
|
||||
return None;
|
||||
}
|
||||
|
||||
Some(u.session().await)
|
||||
Some((u.session().await, u.role))
|
||||
}
|
||||
|
||||
/// Change the password of a `User`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue