diff options
| author | metamuffin <metamuffin@disroot.org> | 2026-01-25 23:32:53 +0100 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2026-01-25 23:32:53 +0100 |
| commit | 783d3598753bf84756296a2016e5dab30300519b (patch) | |
| tree | f7eaf276b65de8aab10db21d27e534f775d83167 /ui/src/components | |
| parent | 5075aede44cb8ab2df10e6debba38483e8d11e96 (diff) | |
| download | jellything-783d3598753bf84756296a2016e5dab30300519b.tar jellything-783d3598753bf84756296a2016e5dab30300519b.tar.bz2 jellything-783d3598753bf84756296a2016e5dab30300519b.tar.zst | |
work on login
Diffstat (limited to 'ui/src/components')
| -rw-r--r-- | ui/src/components/login.rs | 43 | ||||
| -rw-r--r-- | ui/src/components/mod.rs | 16 |
2 files changed, 58 insertions, 1 deletions
diff --git a/ui/src/components/login.rs b/ui/src/components/login.rs new file mode 100644 index 0000000..c54a541 --- /dev/null +++ b/ui/src/components/login.rs @@ -0,0 +1,43 @@ +/* + This file is part of jellything (https://codeberg.org/metamuffin/jellything) + which is licensed under the GNU Affero General Public License (version 3); see /COPYING. + Copyright (C) 2026 metamuffin <metamuffin.org> +*/ + +use jellyui_locale::tr; + +use crate::RenderInfo; + +markup::define! { + AccountSetPassword<'a>(ri: &'a RenderInfo<'a>, session: &'a str) { + form.account[method="POST", action=""] { + h1 { @tr(ri.lang, "account.set_password") } + input[type="text", name="session", hidden, value=session]; br; + + label[for="inp-password"] { @tr(ri.lang, "account.password") } + input[type="password", id="inp-password", name="password"]; br; + + input[type="submit", value=tr(ri.lang, "account.register.submit")]; + + + } + } + AccountLogin<'a>(ri: &'a RenderInfo<'a>) { + form.account[method="POST", action=""] { + h1 { @tr(ri.lang, "account.login") } + + label[for="inp-username"] { @tr(ri.lang, "account.username") } + input[type="text", id="inp-username", name="username"]; br; + label[for="inp-password"] { @tr(ri.lang, "account.password") } + input[type="password", id="inp-password", name="password"]; br; + + input[type="submit", value=tr(ri.lang, if ri.user.is_some() { "account.login.submit.switch" } else { "account.login.submit" })]; + } + } + AccountLogout<'a>(ri: &'a RenderInfo<'a>) { + form.account[method="POST", action=""] { + h1 { @tr(ri.lang, "account.logout") } + input[type="submit", value=tr(ri.lang, "account.logout.submit")]; + } + } +} diff --git a/ui/src/components/mod.rs b/ui/src/components/mod.rs index 07b050b..792894e 100644 --- a/ui/src/components/mod.rs +++ b/ui/src/components/mod.rs @@ -4,6 +4,7 @@ Copyright (C) 2026 metamuffin <metamuffin.org> */ +pub mod login; pub mod message; pub mod node_page; pub mod props; @@ -11,7 +12,11 @@ pub mod stats; use crate::{ RenderInfo, - components::{message::Message, node_page::NodePage}, + components::{ + login::{AccountLogin, AccountLogout, AccountSetPassword}, + message::Message, + node_page::NodePage, + }, }; use jellycommon::{jellyobject::Object, *}; use markup::define; @@ -24,5 +29,14 @@ define! { @if let Some(nku) = view.get(VIEW_NODE_PAGE) { @NodePage { ri, nku } } + @if let Some(()) = view.get(VIEW_ACCOUNT_LOGIN) { + @AccountLogin { ri } + } + @if let Some(()) = view.get(VIEW_ACCOUNT_LOGOUT) { + @AccountLogout{ ri } + } + @if let Some(session) = view.get(VIEW_ACCOUNT_SET_PASSWORD) { + @AccountSetPassword { ri, session } + } } } |