diff options
author | metamuffin <metamuffin@disroot.org> | 2025-04-29 15:19:36 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-04-29 15:19:36 +0200 |
commit | f73aa32549743b2967160d38c1622199c41524a4 (patch) | |
tree | 0fa290fbf9b14d7bfd3803f8cc4618c6c9829330 /server/src/ui/account | |
parent | f62c7f2a8cc143454779dc99334ca9fc80ddabd5 (diff) | |
download | jellything-f73aa32549743b2967160d38c1622199c41524a4.tar jellything-f73aa32549743b2967160d38c1622199c41524a4.tar.bz2 jellything-f73aa32549743b2967160d38c1622199c41524a4.tar.zst |
aaaaaaa
Diffstat (limited to 'server/src/ui/account')
-rw-r--r-- | server/src/ui/account/mod.rs | 19 | ||||
-rw-r--r-- | server/src/ui/account/settings.rs | 42 |
2 files changed, 11 insertions, 50 deletions
diff --git a/server/src/ui/account/mod.rs b/server/src/ui/account/mod.rs index c1e5479..54fa4d0 100644 --- a/server/src/ui/account/mod.rs +++ b/server/src/ui/account/mod.rs @@ -9,12 +9,9 @@ use super::error::MyError; use crate::{ database::Database, locale::AcceptLanguage, - logic::session::{self, Session}, ui::{error::MyResult, home::rocket_uri_macro_r_home}, - uri, }; use anyhow::anyhow; -use argon2::{password_hash::Salt, Argon2, PasswordHasher}; use chrono::Duration; use jellycommon::user::{User, UserPermission}; use rocket::{ @@ -44,21 +41,7 @@ pub async fn r_account_register(lang: AcceptLanguage) -> DynLayoutPage<'static> LayoutPage { title: tr(lang, "account.register").to_string(), content: markup::new! { - form.account[method="POST", action=""] { - h1 { @trs(&lang, "account.register") } - - label[for="inp-invitation"] { @trs(&lang, "account.register.invitation") } - input[type="text", id="inp-invitation", name="invitation"]; br; - - label[for="inp-username"] { @trs(&lang, "account.username") } - input[type="text", id="inp-username", name="username"]; br; - label[for="inp-password"] { @trs(&lang, "account.password") } - input[type="password", id="inp-password", name="password"]; br; - - input[type="submit", value=&*tr(lang, "account.register.submit")]; - - p { @trs(&lang, "account.register.login") " " a[href=uri!(r_account_login())] { @trs(&lang, "account.register.login_here") } } - } + }, ..Default::default() } diff --git a/server/src/ui/account/settings.rs b/server/src/ui/account/settings.rs index 3b53bc4..e6d096f 100644 --- a/server/src/ui/account/settings.rs +++ b/server/src/ui/account/settings.rs @@ -4,27 +4,18 @@ Copyright (C) 2025 metamuffin <metamuffin.org> */ use super::{format_form_error, hash_password}; -use crate::{ - database::Database, - locale::AcceptLanguage, - ui::{ - account::{rocket_uri_macro_r_account_login, session::Session}, - error::MyResult, - layout::{trs, DynLayoutPage, LayoutPage}, - }, - uri, -}; -use jellybase::{ - locale::{tr, Language}, - permission::PermissionSetExt, -}; +use crate::{database::Database, locale::AcceptLanguage, ui::error::MyResult}; +use jellybase::permission::PermissionSetExt; use jellycommon::user::{PlayerKind, Theme, UserPermission}; -use markup::{Render, RenderAttributeValue}; +use jellylogic::session::Session; +use jellyui::locale::Language; use rocket::{ form::{self, validate::len, Contextual, Form}, get, http::uri::fmt::{Query, UriDisplay}, - post, FromForm, State, + post, + response::content::RawHtml, + FromForm, State, }; use std::ops::Range; @@ -47,24 +38,11 @@ fn settings_page( session: Session, flash: Option<MyResult<String>>, lang: Language, -) -> DynLayoutPage<'static> { - LayoutPage { - title: "Settings".to_string(), - class: Some("settings"), - content: - } -} - -struct A<T>(pub T); -impl<T: UriDisplay<Query>> RenderAttributeValue for A<T> {} -impl<T: UriDisplay<Query>> Render for A<T> { - fn render(&self, writer: &mut impl std::fmt::Write) -> std::fmt::Result { - writer.write_fmt(format_args!("{}", &self.0 as &dyn UriDisplay<Query>)) - } +) -> RawHtml<String> { } #[get("/account/settings")] -pub fn r_account_settings(session: Session, lang: AcceptLanguage) -> DynLayoutPage<'static> { +pub fn r_account_settings(session: Session, lang: AcceptLanguage) -> RawHtml<String> { let AcceptLanguage(lang) = lang; settings_page(session, None, lang) } @@ -75,7 +53,7 @@ pub fn r_account_settings_post( database: &State<Database>, form: Form<Contextual<SettingsForm>>, lang: AcceptLanguage, -) -> MyResult<DynLayoutPage<'static>> { +) -> MyResult<RawHtml<String>> { let AcceptLanguage(lang) = lang; session .user |