Add page for reset game password

O01eg
Jan 25, 2022, 2:35 PM
WW3KRXX63EYWW4563QM3VSEN4PGCPR76KJQBYIKCKOCNMDG6JW4QC

Dependencies

  • [2] DESUWE7P Delete unused login.do POST page
  • [3] EVP2FSBH Split index page
  • [4] BCXEUKX6 Add config, static files and web server
  • [5] 65A3LIWU Use handlebars to render index
  • [6] QPHRMBEP Get "Real IP" for proxied build
  • [7] 7R6HAATP Optional publish static files if use reverse-proxy
  • [*] 4MZ4VIR7 Initial commit
  • [*] OJO4B4QO Add login form and empty handler

Change contents

  • file addition: reset-game-pwd.html (----------)
    [4.12]
    <!DOCTYPE html>
    <html>
    <head>
    <link rel="alternate" type="application/rss+xml" href="static/rss.xml" title="Multiplayer FreeOrion server news" />
    <link rel="stylesheet" type="text/css" href="static/style.css" />
    <title>Reset game password</title>
    </head>
    <body>
    <div class="navi">
    </div>
    <div class="content">
    <h1>Reset game password</h1>
    <p><em>Thank you for playing FreeOrion with us.</em><br/>
    <em>Donates are welcome <u>BTC: bc1q04qnmql47zkha6p4edl86hm0wgk90dmsfnl3vl</u></em></p>
    </div>
    </body>
    </html>
  • file addition: reset_game_pwd.rs (----------)
    [3.17]
    use actix_web::http::header;
    use actix_web::{web, HttpResponse};
    use handlebars::Handlebars;
    pub async fn get_reset_game_pwd(hb: web::Data<Handlebars<'_>>) -> HttpResponse {
    let body = hb
    .render("reset-game-pwd", &())
    .expect("render reset-game-pwd");
    HttpResponse::Ok().body(body)
    }
    pub async fn post_reset_game_pwd() -> HttpResponse {
    HttpResponse::Found()
    .append_header((header::LOCATION, "index.html"))
    .finish()
    }
  • edit in src/pages/mod.rs at line 2
    [3.66]
    pub mod reset_game_pwd;
  • edit in src/main.rs at line 13
    [3.423]
    [10.94]
    use pages::reset_game_pwd::get_reset_game_pwd;
    use pages::reset_game_pwd::post_reset_game_pwd;
  • edit in src/main.rs at line 46
    [4.465]
    [4.465]
    .expect("index template");
    handlebars
    .register_template_string(
    "reset-game-pwd",
    include_str!("templates/reset-game-pwd.html"),
    )
  • replacement in src/main.rs at line 68
    [4.647][2.0:57]()
    .route("/index.html", web::get().to(index));
    [4.647]
    [4.261]
    .route("/index.html", web::get().to(index))
    .route(
    "/reset-game-pwd-{token}.html",
    web::get().to(get_reset_game_pwd),
    )
    .route("/reset-game-pwd.do", web::post().to(post_reset_game_pwd));