aboutsummaryrefslogtreecommitdiff
path: root/server/src/routes/ui/account/settings.rs
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/routes/ui/account/settings.rs')
-rw-r--r--server/src/routes/ui/account/settings.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/server/src/routes/ui/account/settings.rs b/server/src/routes/ui/account/settings.rs
index e91bec0..ec92ba2 100644
--- a/server/src/routes/ui/account/settings.rs
+++ b/server/src/routes/ui/account/settings.rs
@@ -36,6 +36,7 @@ pub struct SettingsForm {
display_name: Option<String>,
theme: Option<Theme>,
player_preference: Option<PlayerKind>,
+ native_secret: Option<String>,
}
fn option_len<'v>(value: &Option<String>, range: Range<usize>) -> form::Result<'v, ()> {
@@ -90,6 +91,12 @@ fn settings_page(session: Session, flash: Option<MyResult<String>>) -> DynLayout
}
input[type="submit", value="Apply"];
}
+ form[method="POST", action=uri!(r_account_settings_post())] {
+ label[for="native_secret"] { "Native Secret" }
+ input[type="password", id="native_secret", name="native_secret"];
+ input[type="submit", value="Update"];
+ p { "The secret can be found in " code{"$XDG_CONFIG_HOME/jellynative_secret"} " or by clicking " a.button[href="jellynative://show-secret"] { "Show Secret" } "." }
+ }
},
..Default::default()
}
@@ -151,6 +158,10 @@ pub fn r_account_settings_post(
user.player_preference = player_preference;
out += "Player preference changed.\n";
}
+ if let Some(native_secret) = &form.native_secret {
+ user.native_secret = native_secret.to_owned();
+ out += "Native secret updated.\n";
+ }
users.insert(&*session.user.name, Ser(user))?;
drop(users);