Commit f6cd4048 authored by Robert Czechowski's avatar Robert Czechowski

Add new database field 'account_created' in session

parent a7ec45a7
Pipeline #900 failed with stage
in 1 minute and 47 seconds
......@@ -13,7 +13,6 @@ config.json
*.pdf
*.json
*.yaml
*.sql
*.sqlite
*.csv
/bulma
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -23,7 +23,7 @@ pub struct SessionUser {
pub csrf_token: String,
pub last_login: Option<Timespec>,
pub last_activity: Option<Timespec>,
pub permanent_login: bool,
pub account_created: Option<Timespec>,
pub username: Option<String>,
pub password: Option<String>,
......@@ -198,9 +198,9 @@ impl SessionUser {
session_token: Some(session_token),
csrf_token,
last_login: None,
last_activity: None, // now?
last_activity: None,
account_created: None,
// müssen die überhaupt außerhalb der datenbankabstraktion sichtbar sein?
permanent_login: false,
username: None,
password: None,
......@@ -238,7 +238,7 @@ impl SessionUser {
csrf_token: "".to_string(),
last_login: None,
last_activity: None,
permanent_login: false,
account_created: None,
username: None,
password: None,
......@@ -266,7 +266,7 @@ impl SessionUser {
}
pub fn is_alive(&self) -> bool {
let duration = if self.permanent_login { Duration::days(90) } else { Duration::hours(9) };
let duration = Duration::hours(9); // TODO: hardcoded value, should be moved into constant or sth
let now = time::get_time();
if let Some(last_activity) = self.last_activity {
now - last_activity < duration
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment