Reworked user portal. devided admin and user UI
Build and Publish / Build and Publish Docker Image (push) Successful in 3m7s

This commit is contained in:
Ultradesu
2026-06-30 17:02:56 +03:00
parent c3db347da6
commit 3def3afeda
8 changed files with 1059 additions and 93 deletions
+31 -4
View File
@@ -55,6 +55,15 @@ struct ConfigsTemplate {
app_version: &'static str,
}
#[derive(Debug, Template)]
#[template(path = "client_portal.html")]
struct ClientPortalTemplate {
t: &'static Translations,
user_name: String,
user_role: String,
app_version: &'static str,
}
async fn configs_page(
session: Session,
db: Database,
@@ -64,12 +73,30 @@ async fn configs_page(
Ok(user) => user,
Err(response) => return Ok(response),
};
let is_admin = user.role == auth::Role::Admin;
let user_name = user.name;
let user_role = user.role.code().to_owned();
if is_admin {
return Html::new(
ConfigsTemplate {
t: i18n.t,
user_name,
user_role,
is_admin,
app_version: env!("CARGO_PKG_VERSION"),
}
.render()?,
)
.into_response();
}
Html::new(
ConfigsTemplate {
ClientPortalTemplate {
t: i18n.t,
user_name: user.name,
user_role: user.role.code().to_owned(),
is_admin: user.role == auth::Role::Admin,
user_name,
user_role,
app_version: env!("CARGO_PKG_VERSION"),
}
.render()?,