mirror of
https://github.com/redstrate/Kawari.git
synced 2025-05-12 14:47:46 +00:00
parent
ca8d36e48c
commit
014fc0beea
1 changed files with 11 additions and 2 deletions
|
@ -128,9 +128,10 @@ struct RegisterInput {
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn do_register(
|
async fn do_register(
|
||||||
|
jar: CookieJar,
|
||||||
State(state): State<LoginServerState>,
|
State(state): State<LoginServerState>,
|
||||||
Form(input): Form<RegisterInput>,
|
Form(input): Form<RegisterInput>,
|
||||||
) -> Redirect {
|
) -> (CookieJar, Redirect) {
|
||||||
tracing::info!(
|
tracing::info!(
|
||||||
"Registering with {:#?} and {:#?}!",
|
"Registering with {:#?} and {:#?}!",
|
||||||
input.username,
|
input.username,
|
||||||
|
@ -146,7 +147,15 @@ async fn do_register(
|
||||||
|
|
||||||
state.database.add_user(&username, &password);
|
state.database.add_user(&username, &password);
|
||||||
|
|
||||||
Redirect::to("/")
|
// redirect to account management page
|
||||||
|
let sid = state.database.login_user(&username, &password).unwrap();
|
||||||
|
|
||||||
|
let cookie = Cookie::build(("cis_sessid", sid))
|
||||||
|
.path("/")
|
||||||
|
.secure(false)
|
||||||
|
.expires(Expiration::Session)
|
||||||
|
.http_only(true);
|
||||||
|
(jar.add(cookie), Redirect::to("/account/app/svc/manage"))
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
|
|
Loading…
Add table
Reference in a new issue