diff options
| author | metamuffin <metamuffin@disroot.org> | 2026-02-16 17:50:57 +0100 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2026-02-16 17:50:57 +0100 |
| commit | be4af57d75cc1e233b4714b18198fb7bde49464d (patch) | |
| tree | 6e529e748fc1d5c212dcf8033c8158630ca4f4d6 /server/src/ui/account | |
| parent | bb1822e3e68fe6f699102bfc1659731bdbac1a40 (diff) | |
| download | jellything-be4af57d75cc1e233b4714b18198fb7bde49464d.tar jellything-be4af57d75cc1e233b4714b18198fb7bde49464d.tar.bz2 jellything-be4af57d75cc1e233b4714b18198fb7bde49464d.tar.zst | |
refactor ui responder; add admin import pages
Diffstat (limited to 'server/src/ui/account')
| -rw-r--r-- | server/src/ui/account/mod.rs | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/server/src/ui/account/mod.rs b/server/src/ui/account/mod.rs index 765b6aa..8c60a2d 100644 --- a/server/src/ui/account/mod.rs +++ b/server/src/ui/account/mod.rs @@ -6,40 +6,29 @@ // pub mod settings; use super::error::MyError; -use crate::{auth::login, request_info::RequestInfo, ui::error::MyResult}; +use crate::{ + auth::login, request_info::RequestInfo, ui::error::MyResult, ui_responder::UiResponse, +}; use anyhow::anyhow; use jellycommon::{VIEW_ACCOUNT_LOGIN, VIEW_ACCOUNT_LOGOUT, jellyobject::Object, routes::u_home}; -use jellyui::render_view; use rocket::{ FromForm, form::{Contextual, Form}, get, http::{Cookie, CookieJar}, post, - response::{Flash, Redirect, content::RawHtml}, + response::{Flash, Redirect}, }; use serde::{Deserialize, Serialize}; -#[derive(FromForm)] -pub struct RegisterForm { - #[field(validate = len(8..128))] - pub invitation: String, - #[field(validate = len(4..32))] - pub username: String, - #[field(validate = len(4..64))] - pub password: String, -} - #[get("/account/login")] -pub async fn r_account_login(ri: RequestInfo<'_>) -> RawHtml<String> { - let ob = Object::EMPTY.insert(VIEW_ACCOUNT_LOGIN, ()); - RawHtml(render_view(ri.render_info(), ob.as_object())) +pub async fn r_account_login(ri: RequestInfo<'_>) -> UiResponse { + ri.respond_ui(Object::EMPTY.insert(VIEW_ACCOUNT_LOGIN, ())) } #[get("/account/logout")] -pub fn r_account_logout(ri: RequestInfo<'_>) -> RawHtml<String> { - let ob = Object::EMPTY.insert(VIEW_ACCOUNT_LOGOUT, ()); - RawHtml(render_view(ri.render_info(), ob.as_object())) +pub fn r_account_logout(ri: RequestInfo<'_>) -> UiResponse { + ri.respond_ui(Object::EMPTY.insert(VIEW_ACCOUNT_LOGOUT, ())) } #[derive(FromForm, Serialize, Deserialize)] |