Table of Contents

Class UserForgotPasswordViewModel

Namespace
Dynamicweb.Users.Frontend.UserForgotPassword
Assembly
Dynamicweb.Users.dll

View model for the UserForgotPassword frontend module.

public sealed class UserForgotPasswordViewModel : ViewModelBase
Inheritance
UserForgotPasswordViewModel
Inherited Members
Extension Methods

Examples

Razor template usage:

@inherits ViewModelTemplate<Dynamicweb.Users.Frontend.UserForgotPassword.UserForgotPasswordViewModel> @using Dynamicweb.Users.Frontend.UserForgotPassword

@{ // Reset step var recoverAction = Model.GetRecoverPasswordLink(Pageview.Page.ID); } <form method="post" action="@recoverAction"> <label for="Email">Email</label> <input type="email" id="Email" name="Email" />

<label for="Username">Username</label> <input type="text" id="Username" name="Username" />

<button type="submit">Send password link</button>

@if (Model.Result != UserForgotPasswordResultType.None) { <p class="form-message">@Translate(Model.Result.ToString())&lt;/p&gt; } </form>

@{ // Change step (arrives via emailed RecoveryToken) var changeAction = Model.GetChangePasswordLink(Pageview.Page.ID); } <form method="post" action="@changeAction"> <label for="NewPassword">New password</label> <input type="password" id="NewPassword" name="NewPassword" required />

<label for="ConfirmNewPassword">Confirm new password</label> <input type="password" id="ConfirmNewPassword" name="ConfirmNewPassword" required />

<button type="submit">Change password</button>

@if (Model.Result != UserForgotPasswordResultType.None) { <p class="form-message">@Translate(Model.Result.ToString())&lt;/p&gt; } </form>

Remarks

This model is provided to Razor templates in /Templates/Users/UserForgotPassword/Reset and /Templates/Users/UserForgotPassword/Change. It carries the result of the most recent operation (requesting a reset email or changing the password).

Templates typically render a form that posts to GetRecoverPasswordLink(UserForgotPasswordViewModel, int) (reset step) or GetChangePasswordLink(UserForgotPasswordViewModel, int) (change step), and use Result to display success/error messages.

Properties

Result

Gets or sets the outcome of the most recent reset or change-password attempt.

public UserForgotPasswordResultType Result { get; set; }

Property Value

UserForgotPasswordResultType

Remarks

Use this to render localized feedback in templates. See UserForgotPasswordResultType for the full set of possible values (e.g., MissingValue, MismatchedPasswords, InvalidPasswordComplexity, RecoveryTokenExpired, Success).

See Also

To top