HTYEGVBU6MODOOW4UPEGSHLH4CQFYCDSFVAF2MRQW2RCDP7ITNXQC
WVHXYKCVPKAFVMXBEMD3IHG54RKOIDSOCVNR3OIPEZQG36IGYJZQC
WW3KRXX63EYWW4563QM3VSEN4PGCPR76KJQBYIKCKOCNMDG6JW4QC
BCXEUKX6RVE4UQE46ITSQY2NXYK3MJT7HHL7CJOM7T4OOOCADMIAC
IM5ZPD4NEWQ67NSRP3M4R6FBET5HLY5YCX6WOTGGVWIMRGFD3L3AC
QEK76JYTPKWAN3OIY3U24HMVEIX2GYTEWHII7AD7TUIGTY36DIAAC
OJO4B4QO2JQLMZTGTJJIXEUNDIN45RFLEJBUZBYA7IS34XDPUAVAC
4MZ4VIR7FU3PQ3WKJI6TJIKYOIIBODFEPKLMQ32S4AKPZSDFO6AQC
OWZ67OECVVLVFN2Z7XWITYBU6YUIU42E3SIJDCRKF7M4XDX5XKHAC
{{#if last_error}}
<p class="error">{{ last_error }}</p>
{{/if}}
<form id="reset-game-form" action="reset-game-pwd.do" method="post">
<fieldset>
<legend>Enter data to set new game password:</legend>
<div>
<label for="login">Username:</label>
<input name="login" type="text" placeholder="Username" required autofocus />
</div>
<div>
<label for="password">Password:</label>
<input name="password" type="password" placeholder="Password" required autofocus />
</div>
<div>
<label for="password">Password:</label>
<input name="password_copy" type="password" placeholder="Copy password" required autofocus />
</div>
<input name="token" type="hidden" value="{{ token }}">
<input name="csrf" type="hidden" value="{{ csrf }}">
<input name="submit" type="submit" value="Reset password">
</fieldset>
</form>
let body = match data.handlebars.render("reset-game-pwd", &()) {
let token = match Uuid::parse_str(&token.into_inner()) {
Ok(t) => t,
Err(e) => {
log::warn!("Incorrect token: {}", e);
return HttpResponse::NotFound().body("Not found");
}
};
let dbclient = match data.pool_ro.get().await {
Ok(c) => c,
Err(e) => {
log::error!("Pool RO error {}", e);
return HttpResponse::ServiceUnavailable().body(actix_web::body::None::new());
}
};
let stmt = match dbclient.prepare("select last_error from auth.reset_tokens where token = $1 and NOW() < create_ts + interval '1 day' limit 1;").await {
Ok(stmt) => stmt,
Err(e) => {
log::error!("Pool RO statement error {}", e);
return HttpResponse::ServiceUnavailable().body(actix_web::body::None::new());
}
};
let rows = match dbclient.query_opt(&stmt, &[&token]).await {
Ok(rows) => rows,
Err(e) => {
log::error!("Pool RO query error {}", e);
return HttpResponse::ServiceUnavailable().body(actix_web::body::None::new());
}
};
let row = match rows {
Some(row) => row,
None => {
return HttpResponse::NotFound().body("Not found");
}
};
let last_error = row.get::<_, Option<&str>>(0);
let csrf = Uuid::new_v4();
let body = match data.handlebars.render(
"reset-game-pwd",
&PageData {
token,
csrf,
last_error,
},
) {