diff options
Diffstat (limited to 'server/src/auth.rs')
| -rw-r--r-- | server/src/auth.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/server/src/auth.rs b/server/src/auth.rs index 7cb2d54..c827126 100644 --- a/server/src/auth.rs +++ b/server/src/auth.rs @@ -115,7 +115,7 @@ impl<'r> FromRequest<'r> for Session { .get_private(SESSION_COOKIE) .and_then(|cookie| -> Option<Session> { json::from_str(cookie.value()).ok() }) .and_then(|session| { - if validate(&sessions, &session, request) { + if validate(sessions, &session, request) { Some(session) } else { None @@ -146,9 +146,9 @@ fn new_session( sessions_data.active_ids.insert(session_id, now + max_age); } Session { - user_id: user_id, - session_id: session_id, - remote: remote, + user_id, + session_id, + remote, } } @@ -173,7 +173,7 @@ fn login( ) -> Result<Json<api_model::StatusResponse>, Unauthorized<&'static str>> { if login.username == "user" && login.password == "password" { let max_age = Duration::days(i64::from(auth_config.session_max_age_days)); - let session = new_session(&sessions, 1u64, ipaddr.to_string(), max_age); + let session = new_session(sessions, 1u64, ipaddr.to_string(), max_age); let cookie = Cookie::build((SESSION_COOKIE, json::to_string(&session).unwrap())) .path("/api") |
