Merge pull request #13 from jxs/bugfix/api-http-auth
fix bug on api.rs, only insert username in the session if authentication was successful
This commit is contained in:
commit
b24f3f1d10
1 changed files with 4 additions and 2 deletions
|
@ -237,8 +237,10 @@ impl Handler for AuthHandler {
|
||||||
if let Some(ref password) = auth.password {
|
if let Some(ref password) = auth.password {
|
||||||
auth_success =
|
auth_success =
|
||||||
user::auth(self.db.deref(), auth.username.as_str(), password.as_str())?;
|
user::auth(self.db.deref(), auth.username.as_str(), password.as_str())?;
|
||||||
req.extensions
|
if auth_success {
|
||||||
.insert::<SessionKey>(Session { username: auth.username.clone() });
|
req.extensions
|
||||||
|
.insert::<SessionKey>(Session { username: auth.username.clone() });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue