@smbcloud / cli / commits / 1d0baff

move resend_reset_password_instruction to networking account crate

Seto committed Jan 1, 2026 at 22:39 UTC 1d0baff75c47b875daac792e078b33d8c20669a0
3 files changed +39 -18
crates/cli/src/account/login/process.rs
+4 -18
@@ -27,15 +27,14 @@ use {
27 },
28 smbcloud_network::environment::Environment,
29 smbcloud_networking::{
30 - constants::{
31 - PATH_LINK_GITHUB_ACCOUNT, PATH_RESET_PASSWORD_INSTRUCTIONS, PATH_USERS_PASSWORD,
32 - },
30 + constants::{PATH_LINK_GITHUB_ACCOUNT, PATH_USERS_PASSWORD},
31 smb_base_url_builder,
32 smb_client::SmbClient,
33 },
34 smbcloud_networking_account::{
35 check_email::check_email, login::login,
36 resend_email_verification::resend_email_verification as account_resend_email_verification,
37 + resend_reset_password_instruction::resend_reset_password_instruction as account_resend_reset_password_instruction,
38 },
39 smbcloud_utils::email_validation,
40 spinners::Spinner,
@@ -468,16 +467,9 @@ async fn resend_reset_password_instruction(env: Environment, user: User) -> Resu
467 spinners::Spinners::SimpleDotsScrolling,
468 succeed_message("Sending reset password instruction..."),
469 );
471 - let response = Client::new()
472 - .post(build_smb_resend_reset_password_instructions_url(env))
473 - .body(format!("id={}", user.id))
474 - .header("Accept", "application/json")
475 - .header("Content-Type", "application/x-www-form-urlencoded")
476 - .send()
477 - .await?;
470
479 - match response.status() {
480 - StatusCode::OK => {
471 + match account_resend_reset_password_instruction(env, SmbClient::Cli, user.id).await {
472 + Ok(_) => {
473 spinner.stop_and_persist(
474 "✅",
475 "Reset password instruction sent! Please check your email.".to_owned(),
@@ -547,12 +539,6 @@ async fn input_reset_password_token(env: Environment) -> Result<CommandResult> {
539 }
540 }
541
550 -fn build_smb_resend_reset_password_instructions_url(env: Environment) -> String {
551 - let mut url_builder = smb_base_url_builder(env, &SmbClient::Cli);
552 - url_builder.add_route(PATH_RESET_PASSWORD_INSTRUCTIONS);
553 - url_builder.build()
554 -}
555 -
542 fn build_smb_reset_password_url(env: Environment) -> String {
543 let mut url_builder = smb_base_url_builder(env, &SmbClient::Cli);
544 url_builder.add_route(PATH_USERS_PASSWORD);
crates/smbcloud-networking-account/src/lib.rs
+1
@@ -5,4 +5,5 @@ pub mod me;
5 pub mod oauth;
6 pub mod remove;
7 pub mod resend_email_verification;
8 +pub mod resend_reset_password_instruction;
9 pub mod signup;
crates/smbcloud-networking-account/src/resend_reset_password_instruction.rs new
+34
@@ -0,0 +1,34 @@
1 +use {
2 + reqwest::Client,
3 + smbcloud_model::{account::SmbAuthorization, error_codes::ErrorResponse},
4 + smbcloud_network::{environment::Environment, network::request},
5 + smbcloud_networking::{
6 + constants::PATH_RESET_PASSWORD_INSTRUCTIONS, smb_base_url_builder, smb_client::SmbClient,
7 + },
8 +};
9 +
10 +pub async fn resend_reset_password_instruction(
11 + env: Environment,
12 + client: SmbClient,
13 + user_id: i32,
14 +) -> Result<SmbAuthorization, ErrorResponse> {
15 + let builder = Client::new()
16 + .post(build_smb_resend_reset_password_instructions_url(
17 + env, &client,
18 + ))
19 + .body(format!("id={}", user_id))
20 + .header("User-agent", client.id())
21 + .header("Accept", "application/json")
22 + .header("Content-Type", "application/x-www-form-urlencoded");
23 +
24 + request(builder).await
25 +}
26 +
27 +fn build_smb_resend_reset_password_instructions_url(
28 + env: Environment,
29 + client: &SmbClient,
30 +) -> String {
31 + let mut url_builder = smb_base_url_builder(env, client);
32 + url_builder.add_route(PATH_RESET_PASSWORD_INSTRUCTIONS);
33 + url_builder.build()
34 +}