diff options
author | metamuffin <metamuffin@disroot.org> | 2023-10-01 00:38:29 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2023-10-01 00:38:29 +0200 |
commit | fc5e13ae525cb74e77a5bc51204f44476115cea9 (patch) | |
tree | a20b6d296d67735a2c8d42a0dc31b44c0bb53cb7 /server/src/routes/ui/account/mod.rs | |
parent | d546caa3f5053ade763430490911fefd6257af9f (diff) | |
download | jellything-fc5e13ae525cb74e77a5bc51204f44476115cea9.tar jellything-fc5e13ae525cb74e77a5bc51204f44476115cea9.tar.bz2 jellything-fc5e13ae525cb74e77a5bc51204f44476115cea9.tar.zst |
draft for permission framework
Diffstat (limited to 'server/src/routes/ui/account/mod.rs')
-rw-r--r-- | server/src/routes/ui/account/mod.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/server/src/routes/ui/account/mod.rs b/server/src/routes/ui/account/mod.rs index b7ba332..a4aa2dd 100644 --- a/server/src/routes/ui/account/mod.rs +++ b/server/src/routes/ui/account/mod.rs @@ -8,7 +8,7 @@ pub mod settings; use super::{error::MyError, layout::LayoutPage}; use crate::{ - database::{Database, User}, + database::Database, routes::ui::{error::MyResult, home::rocket_uri_macro_r_home, layout::DynLayoutPage}, uri, }; @@ -16,6 +16,7 @@ use anyhow::anyhow; use argon2::{password_hash::Salt, Argon2, PasswordHasher}; use chrono::Duration; use jellybase::CONF; +use jellycommon::user::{PermissionSet, User}; use rocket::{ form::{Contextual, Form}, get, @@ -131,6 +132,7 @@ pub fn r_account_register_post<'a>( name: form.username.clone(), password: hash_password(&form.username, &form.password), admin: false, + permissions: PermissionSet::default(), }), ) .unwrap() @@ -188,7 +190,7 @@ pub fn login_logic(database: &Database, username: &str, password: &str) -> MyRes } Ok(session::token::create( - user.name, + &user, Duration::days(CONF.login_expire), )) } |