Create form to request game password change link

O01eg
Apr 13, 2022, 7:57 AM
WLWTNO4YJ4VBMJYVTP2LGPFQAJTOB524BD5INJFA44X2FKAX76DQC

Dependencies

  • [2] GZNMGW5M Move footer to separate file
  • [3] WVHXYKCV Add postgresql pools
  • [4] WW3KRXX6 Add page for reset game password
  • [5] BCXEUKX6 Add config, static files and web server
  • [6] HZDCKIXQ Use constants for templates
  • [7] HTYEGVBU Add data to reset password page
  • [8] 6CFNBL5L Add headers for better security
  • [9] 65A3LIWU Use handlebars to render index
  • [*] 4MZ4VIR7 Initial commit
  • [*] EVP2FSBH Split index page

Change contents

  • replacement in src/templates/reset-game-pwd.html at line 22
    [3.266][3.266:343]()
    <input name="login" type="text" placeholder="Username" required autofocus />
    [3.266]
    [3.343]
    <input name="login" id="login" type="text" placeholder="Username" required autofocus />
  • replacement in src/templates/reset-game-pwd.html at line 26
    [3.396][3.396:480]()
    <input name="password" type="password" placeholder="Password" required autofocus />
    [3.396]
    [3.480]
    <input name="password" id="password" type="password" placeholder="Password" required autofocus />
  • replacement in src/templates/reset-game-pwd.html at line 29
    [3.493][3.493:627]()
    <label for="password">Password:</label>
    <input name="password_copy" type="password" placeholder="Copy password" required autofocus />
    [3.493]
    [3.627]
    <label for="password_copy">Password:</label>
    <input name="password_copy" id="password_copy" type="password" placeholder="Copy password" required autofocus />
  • replacement in src/templates/query-reset-game-pwd.html at line 12
    [3.268][2.234:247]()
    {{> footer}}
    [3.268]
    [3.414]
    <h1>Reset game password</h1>
    <form id="query-reset-game-form" action="query-reset-game-pwd.do" method="post">
    <fieldset>
    <legend>Enter contact data to request game password change:</legend>
    <div>
    <label for="login">Username:</label>
    <input name="login" id="login" type="text" placeholder="Username" required autofocus />
    </div>
    <div>
    <input type="radio" name="contact_type" value="email">E-mail<br>
    </div>
    <div>
    <label for="contact">Contact:</label>
    <input name="contact" id="contact" type="text" placeholder="Contact" required autofocus />
    </div>
    <input name="csrf" type="hidden" value="{{ csrf }}">
    <input name="submit" type="submit" value="Reset password">
    </fieldset>
    </form>
  • edit in src/templates/query-reset-game-pwd.html at line 32
    [3.421]
    [3.421]
    {{> footer}}
  • edit in src/pages/query_reset_game_pwd.rs at line 1
    [3.557]
    [3.558]
    use actix_web::http::header;
  • edit in src/pages/query_reset_game_pwd.rs at line 7
    [3.666]
    [3.666]
    use uuid::Uuid;
    #[derive(serde_derive::Serialize)]
    struct PageData {
    csrf: Uuid,
    }
    #[derive(serde_derive::Deserialize)]
    pub struct FormData {
    login: String,
    contact_type: String,
    contact: String,
    csrf: Uuid,
    }
  • replacement in src/pages/query_reset_game_pwd.rs at line 24
    [3.749][3.749:822]()
    let body = match data.handlebars.render(QUERY_RESET_GAME_PWD, &()) {
    [3.749]
    [3.822]
    let body = match data.handlebars.render(
    QUERY_RESET_GAME_PWD,
    &PageData {
    csrf: Uuid::new_v4(),
    },
    ) {
  • replacement in src/pages/query_reset_game_pwd.rs at line 32
    [3.862][3.862:916]()
    log::error!("Render index error: {}", e);
    [3.862]
    [3.916]
    log::error!("Render error: {}", e);
  • edit in src/pages/query_reset_game_pwd.rs at line 38
    [3.1059]
    #[actix_web::post("/query-reset-game-pwd.do")]
    pub async fn post_query_reset_game_pwd(
    form: web::Form<FormData>,
    data: web::Data<WebData<'_>>,
    ) -> HttpResponse {
    HttpResponse::Found()
    .append_header((header::LOCATION, "index.html"))
    .finish()
    }
  • edit in src/main.rs at line 15
    [12.423]
    [3.1548]
    use pages::query_reset_game_pwd::post_query_reset_game_pwd;
  • replacement in src/main.rs at line 84
    [3.384][2.331:432]()
    .register_template_string(templates::sub::FOOTER, include_str!("templates/sub/footer.html"))
    [3.384]
    [2.432]
    .register_template_string(
    templates::sub::FOOTER,
    include_str!("templates/sub/footer.html"),
    )
  • edit in src/main.rs at line 141
    [3.2461]
    [3.1949]
    .service(post_query_reset_game_pwd)