Class ForgotPasswordUriProvider
Provides URIs used in the forgot password process for user account recovery.
Inheritance
Namespace: Umbraco.Cms.Api.Management.Security
Assembly: Umbraco.Cms.Api.Management.dll
Syntax
public class ForgotPasswordUriProvider : IForgotPasswordUriProvider
Constructors
View SourceForgotPasswordUriProvider(ICoreBackOfficeUserManager, IHostingEnvironment, IHttpContextAccessor)
Initializes a new instance of the ForgotPasswordUriProvider class.
Declaration
public ForgotPasswordUriProvider(ICoreBackOfficeUserManager userManager, IHostingEnvironment hostingEnvironment, IHttpContextAccessor httpContextAccessor)
Parameters
| Type | Name | Description |
|---|---|---|
| ICoreBackOfficeUserManager | userManager | An ICoreBackOfficeUserManager instance for managing back office users. |
| IHostingEnvironment | hostingEnvironment | An IHostingEnvironment instance representing the current hosting environment. |
| IHttpContextAccessor | httpContextAccessor | An Microsoft.AspNetCore.Http.IHttpContextAccessor instance for accessing the current HTTP context. |
Methods
View SourceCanCreateForgotPasswordUriAsync()
Determines whether forgot password URIs can currently be created, regardless of the user they are for.
Declaration
public Task<Attempt<UserOperationStatus>> CanCreateForgotPasswordUriAsync()
Returns
| Type | Description |
|---|---|
| Task<Attempt<UserOperationStatus>> | A successful attempt, or a failed attempt with the reason URIs cannot be created. |
Remarks
This is checked before the user is looked up, so the outcome must not depend on any particular user.
CreateForgotPasswordUriAsync(IUser)
Creates a forgot password URI for the specified user.
Declaration
public Task<Attempt<Uri, UserOperationStatus>> CreateForgotPasswordUriAsync(IUser user)
Parameters
| Type | Name | Description |
|---|---|---|
| IUser | user | The user to create the forgot password URI for. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<Uri, UserOperationStatus>> | An attempt containing the generated URI or an error status. |
Remarks
Failures that do not depend on the user should also be reported by CanCreateForgotPasswordUriAsync(), so they are reported the same way whether or not the email belongs to a user.