Start support for XMPP game password change

O01eg
Apr 13, 2022, 1:44 PM
4JK5O45HRXZ7BFIGM226RMFEUFXNX2O4IHCFRDSBH356DUG5674QC

Dependencies

  • [2] ZRU62WXD Send email with change game password link
  • [3] TRBYOQBI Check CSRF and user existence
  • [4] WLWTNO4Y Create form to request game password change link
  • [5] I6SOPEQF Create and store reset password token
  • [*] HZDCKIXQ Use constants for templates
  • [*] EVP2FSBH Split index page
  • [*] WVHXYKCV Add postgresql pools
  • [*] 4MZ4VIR7 Initial commit
  • [*] BCXEUKX6 Add config, static files and web server
  • [*] Z3SYSC25 Add SMTP configuration
  • [*] 7R6HAATP Optional publish static files if use reverse-proxy

Change contents

  • edit in src/templates/query-reset-game-pwd.html at line 22
    [3.756]
    [3.756]
    <input type="radio" name="contact_type" value="xmpp">XMPP<br>
  • edit in src/pages/query_reset_game_pwd.rs at line 70
    [2.723]
    [2.723]
    }
    enum Protocol {
    Email,
    Xmpp,
  • replacement in src/pages/query_reset_game_pwd.rs at line 91
    [3.721][3.721:902]()
    if form.contact_type != "email" {
    log::warn!("Unknown data for contact type: {}", form.contact_type);
    return HttpResponse::BadRequest().body("Incorrect");
    }
    [3.721]
    [3.902]
    let protocol = match form.contact_type.as_str() {
    "email" => Protocol::Email,
    "xmpp" => Protocol::Xmpp,
    _ => {
    log::warn!("Unknown data for contact type: {}", form.contact_type);
    return HttpResponse::BadRequest().body("Incorrect");
    }
    };
  • replacement in src/pages/query_reset_game_pwd.rs at line 161
    [3.1180][3.1180:1304]()
    log::info!(
    "Sending {} type {} to {}",
    token_url,
    form.contact_type,
    form.login
    );
    [3.1180]
    [3.1304]
    match protocol {
    Protocol::Email => {
    if let Err(e) =
    send_email(&data.mailer, &data.mailer_from, token_url, &form.contact).await
    {
    log::error!("Cann't send email: {}", e);
    return HttpResponse::ServiceUnavailable().body(actix_web::body::None::new());
    }
    }
    Protocol::Xmpp => {}
    };
  • edit in src/pages/query_reset_game_pwd.rs at line 173
    [3.1305][2.727:967]()
    if let Err(e) = send_email(&data.mailer, &data.mailer_from, token_url, &form.contact).await {
    log::error!("Cann't send email: {}", e);
    return HttpResponse::ServiceUnavailable().body(actix_web::body::None::new());
    }
  • edit in src/pages/mod.rs at line 37
    [2.1083]
    [9.559]
    pub xmpp_url: String,
  • edit in src/main.rs at line 51
    [2.1098]
    [9.856]
    xmpp_url,
  • edit in src/main.rs at line 142
    [2.1619]
    [9.1899]
    xmpp_url,
  • edit in src/config.rs at line 36
    [12.486]
    [13.731]
    pub xmpp_url: String,