diff options
| author | metamuffin <metamuffin@disroot.org> | 2026-02-27 14:40:15 +0100 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2026-02-27 14:40:15 +0100 |
| commit | c05bfcc2775f0e11db6e856bfcf06d0419c35d54 (patch) | |
| tree | ffd0e9fcf6b476a6198287085a514cfa7940c200 /server/src/ui/account/mod.rs | |
| parent | 4ba86694e393c61107e27c4127efc0455b329524 (diff) | |
| download | jellything-c05bfcc2775f0e11db6e856bfcf06d0419c35d54.tar jellything-c05bfcc2775f0e11db6e856bfcf06d0419c35d54.tar.bz2 jellything-c05bfcc2775f0e11db6e856bfcf06d0419c35d54.tar.zst | |
ui changed before object slices
Diffstat (limited to 'server/src/ui/account/mod.rs')
| -rw-r--r-- | server/src/ui/account/mod.rs | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/server/src/ui/account/mod.rs b/server/src/ui/account/mod.rs index ab5093d..b106fc7 100644 --- a/server/src/ui/account/mod.rs +++ b/server/src/ui/account/mod.rs @@ -12,33 +12,37 @@ use crate::{ auth::{hash_password, login}, request_info::RequestInfo, ui::error::MyResult, - ui_responder::UiResponse, }; use anyhow::anyhow; use jellycommon::{ - jellyobject::{OBB, Path}, + jellyobject::Path, routes::{u_account_login, u_home}, *, }; use jellydb::{Filter, Query}; +use jellyui::components::login::{AccountLogin, AccountLogout, AccountSetPassword}; use rocket::{ Either, FromForm, form::{Contextual, Form}, get, http::{Cookie, CookieJar}, post, - response::{Flash, Redirect}, + response::{Flash, Redirect, content::RawHtml}, }; use serde::{Deserialize, Serialize}; #[get("/account/login")] -pub async fn r_account_login(ri: RequestInfo<'_>) -> UiResponse { - ri.respond_ui(OBB::new().with(VIEW_ACCOUNT_LOGIN, ())) +pub async fn r_account_login(ri: RequestInfo<'_>) -> RawHtml<String> { + ri.respond_ui(&AccountLogin { + ri: &ri.render_info(), + }) } #[get("/account/logout")] -pub fn r_account_logout(ri: RequestInfo<'_>) -> UiResponse { - ri.respond_ui(OBB::new().with(VIEW_ACCOUNT_LOGOUT, ())) +pub fn r_account_logout(ri: RequestInfo<'_>) -> RawHtml<String> { + ri.respond_ui(&AccountLogout { + ri: &ri.render_info(), + }) } #[derive(FromForm, Serialize, Deserialize)] @@ -60,7 +64,7 @@ pub fn r_account_login_post( ri: RequestInfo<'_>, jar: &CookieJar, form: Form<Contextual<LoginForm>>, -) -> MyResult<Either<Redirect, UiResponse>> { +) -> MyResult<Either<Redirect, RawHtml<String>>> { let form = match &form.value { Some(v) => v, None => return Err(MyError(anyhow!(format_form_error(form)))), @@ -88,18 +92,11 @@ pub fn r_account_login_post( Ok(()) })?; } else { - return Ok(Either::Right( - ri.respond_ui( - OBB::new().with( - VIEW_ACCOUNT_SET_PASSWORD, - OBB::new() - .with(SETPW_USERNAME, &form.username) - .with(SETPW_PASSWORD, &form.password) - .finish() - .as_object(), - ), - ), - )); + return Ok(Either::Right(ri.respond_ui(&AccountSetPassword { + ri: &ri.render_info(), + password: &form.password, + username: &form.username, + }))); } } |