release/v0.7.4
claude/smbcloud-github-app-k9641p
development
feature/apps
feature/build-release
feature/ci-docs
feature/ci-ruby-gems
feature/cicd
feature/completion
feature/dist-nuget
feature/fix-ci-sdk-pypi-rubygem
feature/fix-clippy-on-stable-channel
feature/fix-deployment-script
feature/github-email
feature/gresiq-v1
feature/project-new-structure
feature/rsync-deploy
feature/ruby-runner
feature/sdk-npm
feature/sdk-workflows
feature/smbcloud-cli-release-npm
feature/smbcloud-deploy
feature/wasm
main
release/v0.7.4
| 1 | use { |
| 2 | crate::client_credentials::{ClientCredentials, base_url_builder as tenant_base_url_builder}, |
| 3 | reqwest::Client, |
| 4 | smbcloud_model::{ |
| 5 | error_codes::ErrorResponse, |
| 6 | forgot::{Args, Email}, |
| 7 | reset_password_response::ResetPasswordResponse, |
| 8 | }, |
| 9 | smbcloud_network::{environment::Environment, network::request}, |
| 10 | }; |
| 11 | |
| 12 | /// Requests password-reset instructions for a tenant `AuthUser`. |
| 13 | /// |
| 14 | /// Hits `POST /v1/client/users/reset_password`. The endpoint never reveals |
| 15 | /// whether the email belongs to a real account (no enumeration), so it always |
| 16 | /// resolves with a neutral message on success. Calling it again re-issues the |
| 17 | /// reset token, so the same call also serves the "resend reset instructions" |
| 18 | /// flow — the tenant plane has no separate resend endpoint. |
| 19 | pub async fn reset_password_with_client( |
| 20 | env: Environment, |
| 21 | client: ClientCredentials<'_>, |
| 22 | email: String, |
| 23 | ) -> Result<ResetPasswordResponse, ErrorResponse> { |
| 24 | let params = Args { |
| 25 | user: Email { email }, |
| 26 | }; |
| 27 | let builder = Client::new() |
| 28 | .post(build_reset_password_url(env, client)) |
| 29 | .json(¶ms) |
| 30 | .header("User-agent", client.app_id); |
| 31 | request(builder).await |
| 32 | } |
| 33 | |
| 34 | fn build_reset_password_url(env: Environment, client: ClientCredentials<'_>) -> String { |
| 35 | let mut url_builder = tenant_base_url_builder(env, client); |
| 36 | url_builder.add_route("v1/client/users/reset_password"); |
| 37 | url_builder.build() |
| 38 | } |