Reworked user portal. devided admin and user UI
Build and Publish / Build and Publish Docker Image (push) Successful in 3m7s
Build and Publish / Build and Publish Docker Image (push) Successful in 3m7s
This commit is contained in:
+31
-4
@@ -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()?,
|
||||
|
||||
Reference in New Issue
Block a user