aboutsummaryrefslogtreecommitdiff
path: root/ui/src/account/mod.rs
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2025-04-29 17:06:23 +0200
committermetamuffin <metamuffin@disroot.org>2025-04-29 17:06:23 +0200
commit212a0f23bc894faf88e159560c113f504349cc05 (patch)
treeee2ff0ff3b185d1874eb0e8fc4b75f1badf659b8 /ui/src/account/mod.rs
parentf73aa32549743b2967160d38c1622199c41524a4 (diff)
downloadjellything-212a0f23bc894faf88e159560c113f504349cc05.tar
jellything-212a0f23bc894faf88e159560c113f504349cc05.tar.bz2
jellything-212a0f23bc894faf88e159560c113f504349cc05.tar.zst
comiles again but still many logic holes
Diffstat (limited to 'ui/src/account/mod.rs')
-rw-r--r--ui/src/account/mod.rs83
1 files changed, 81 insertions, 2 deletions
diff --git a/ui/src/account/mod.rs b/ui/src/account/mod.rs
index bc8d3ce..36a41c5 100644
--- a/ui/src/account/mod.rs
+++ b/ui/src/account/mod.rs
@@ -3,8 +3,55 @@
which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
Copyright (C) 2025 metamuffin <metamuffin.org>
*/
-use crate::locale::{Language, tr, trs};
-use jellycommon::routes::u_account_login;
+pub mod settings;
+
+use crate::{
+ Page,
+ locale::{Language, tr, trs},
+};
+use jellycommon::routes::{u_account_login, u_account_register};
+
+impl Page for AccountLogin<'_> {
+ fn title(&self) -> String {
+ tr(
+ *self.lang,
+ if self.logged_in {
+ "account.login.switch"
+ } else {
+ "account.login"
+ },
+ )
+ .to_string()
+ }
+
+ fn to_render(&self) -> markup::DynRender {
+ markup::new!(@self)
+ }
+}
+impl Page for AccountRegister<'_> {
+ fn title(&self) -> String {
+ tr(*self.lang, "account.register").to_string()
+ }
+ fn to_render(&self) -> markup::DynRender {
+ markup::new!(@self)
+ }
+}
+impl Page for AccountRegisterSuccess<'_> {
+ fn title(&self) -> String {
+ tr(*self.lang, "account.register").to_string()
+ }
+ fn to_render(&self) -> markup::DynRender {
+ markup::new!(@self)
+ }
+}
+impl Page for AccountLogout<'_> {
+ fn title(&self) -> String {
+ tr(*self.lang, "account.logout").to_string()
+ }
+ fn to_render(&self) -> markup::DynRender {
+ markup::new!(@self)
+ }
+}
markup::define! {
AccountRegister<'a>(lang: &'a Language) {
@@ -24,4 +71,36 @@ markup::define! {
p { @trs(&lang, "account.register.login") " " a[href=u_account_login()] { @trs(&lang, "account.register.login_here") } }
}
}
+ AccountRegisterSuccess<'a>(lang: &'a Language, logged_in: bool) {
+ h1 { @trs(&lang, if *logged_in {
+ "account.register.success.switch"
+ } else {
+ "account.register.success"
+ })}
+ }
+ AccountLogin<'a>(lang: &'a Language, logged_in: bool) {
+ form.account[method="POST", action=""] {
+ h1 { @self.title() }
+
+ 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, if *logged_in { "account.login.submit.switch" } else { "account.login.submit" })];
+
+ @if *logged_in {
+ p { @trs(&lang, "account.login.register.switch") " " a[href=u_account_register()] { @trs(&lang, "account.login.register_here") } }
+ } else {
+ p { @trs(&lang, "account.login.cookie_note") }
+ p { @trs(&lang, "account.login.register") " " a[href=u_account_register()] { @trs(&lang, "account.login.register_here") } }
+ }
+ }
+ }
+ AccountLogout<'a>(lang: &'a Language) {
+ form.account[method="POST", action=""] {
+ h1 { @trs(&lang, "account.logout") }
+ input[type="submit", value=&*tr(**lang, "account.logout.submit")];
+ }
+ }
}