mirror of
https://github.com/redstrate/Kawari.git
synced 2025-04-19 22:36:49 +00:00
Add stubs for changing password and canceling account pages
This commit is contained in:
parent
09c347178c
commit
a1539d1931
3 changed files with 39 additions and 0 deletions
|
@ -22,6 +22,11 @@ fn setup_default_environment() -> Environment<'static> {
|
||||||
.unwrap();
|
.unwrap();
|
||||||
env.add_template("account.html", include_str!("../../templates/account.html"))
|
env.add_template("account.html", include_str!("../../templates/account.html"))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
env.add_template(
|
||||||
|
"changepassword.html",
|
||||||
|
include_str!("../../templates/changepassword.html"),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
env
|
env
|
||||||
}
|
}
|
||||||
|
@ -193,6 +198,18 @@ async fn logout(State(state): State<LoginServerState>, jar: CookieJar) -> (Cooki
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn change_password() -> Html<String> {
|
||||||
|
// TODO: actually change password
|
||||||
|
let environment = setup_default_environment();
|
||||||
|
let template = environment.get_template("changepassword.html").unwrap();
|
||||||
|
Html(template.render(context! {}).unwrap())
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn cancel_account(jar: CookieJar) -> (CookieJar, Redirect) {
|
||||||
|
// TODO: actually delete account
|
||||||
|
(jar.remove("cis_sessid"), Redirect::to("/"))
|
||||||
|
}
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
tracing_subscriber::fmt::init();
|
tracing_subscriber::fmt::init();
|
||||||
|
@ -215,6 +232,8 @@ async fn main() {
|
||||||
.route("/oauth/oa/registlist", post(do_register))
|
.route("/oauth/oa/registlist", post(do_register))
|
||||||
.route("/account/app/svc/manage", get(account))
|
.route("/account/app/svc/manage", get(account))
|
||||||
.route("/account/app/svc/logout", get(logout))
|
.route("/account/app/svc/logout", get(logout))
|
||||||
|
.route("/account/app/svc/mbrPasswd", get(change_password))
|
||||||
|
.route("/account/app/svc/mbrCancel", get(cancel_account))
|
||||||
.with_state(state);
|
.with_state(state);
|
||||||
|
|
||||||
let config = get_config();
|
let config = get_config();
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
<p>Managing account {{ username }}</p>
|
<p>Managing account {{ username }}</p>
|
||||||
<a href="/account/app/svc/logout">Logout</a>
|
<a href="/account/app/svc/logout">Logout</a>
|
||||||
|
<a href="/account/app/svc/mbrPasswd">Change Password</a>
|
||||||
|
<a href="/account/app/svc/mbrCancel">Cancel Account</a>
|
||||||
|
|
18
templates/changepassword.html
Normal file
18
templates/changepassword.html
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Kawari - Change Password</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<form method='post'>
|
||||||
|
<label for="old_password">Old Password:</label><br>
|
||||||
|
<input type='text' id='old_password' name='old_password'/><br>
|
||||||
|
<label for="new_password">New Password:</label><br>
|
||||||
|
<input type='text' id='new_ppassword' name='new_password'/><br>
|
||||||
|
<button type='submit'>Submit</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Add table
Reference in a new issue