Send reset game password via XMPP

O01eg
Apr 13, 2022, 2:19 PM
J4BBSAZR5O5BSIAZHLHAZS6FXVTUNJC6KFERLS3AC5BVKFJY57EQC

Dependencies

  • [2] 4JK5O45H Start support for XMPP game password change
  • [3] I6SOPEQF Create and store reset password token
  • [*] HZDCKIXQ Use constants for templates
  • [*] ZRU62WXD Send email with change game password link

Change contents

  • edit in src/pages/query_reset_game_pwd.rs at line 68
    [6.711]
    [6.711]
    Ok(())
    }
    async fn send_xmpp(
    xmpp_url: &str,
    token_url: String,
    to: &str,
    ) -> Result<(), Box<dyn std::error::Error>> {
    let client = awc::Client::default();
    client
    .post(xmpp_url)
    .insert_header(("X-XMPP-To", to))
    .send_body(format!(
    "You requested change for FreeOrion game password.\n\
    Use next link {} to enter new password. Link is active for 24 hours.\n\
    Don't send it to other people.",
    token_url
    ))
    .await?;
  • replacement in src/pages/query_reset_game_pwd.rs at line 191
    [2.767][2.767:796]()
    Protocol::Xmpp => {}
    [2.767]
    [2.796]
    Protocol::Xmpp => {
    if let Err(e) = send_xmpp(&data.xmpp_url, token_url, &form.contact).await {
    log::error!("Cann't send xmpp: {}", e);
    return HttpResponse::ServiceUnavailable().body(actix_web::body::None::new());
    }
    }