Class UserChangePasswordViewModel
- Namespace
- Dynamicweb.Users.Frontend.UserChangePassword
- Assembly
- Dynamicweb.Users.dll
View model for the UserChangePassword frontend module.
public sealed class UserChangePasswordViewModel : ViewModelBase
- Inheritance
-
UserChangePasswordViewModel
- Inherited Members
- Extension Methods
Examples
Full Razor template example:
@inherits ViewModelTemplate<Dynamicweb.Users.Frontend.UserChangePassword.UserChangePasswordViewModel> @using Dynamicweb.Users.Frontend.UserChangePassword
@switch (Model.Result) { case UserChangePasswordResultType.Success: <div class="alert alert-success">Your password was changed.</div>; break; case UserChangePasswordResultType.InvalidOldPassword: <div class="alert alert-danger">Current password is incorrect.</div>; break; case UserChangePasswordResultType.MismatchedPasswords: <div class="alert alert-danger">New passwords do not match.</div>; break; // Handle other result cases as needed… }
Remarks
This model is passed to Razor templates in /Templates/Users/UserChangePassword/Change.
It exposes the outcome of the latest change-password attempt via Result so
the template can render contextual feedback (success, validation errors, etc.).
The module processes POST requests to the page when the action URL contains
?Cmd=ChangePassword. After a successful update it redirects back to the same page
(without the Cmd query parameter) and sets Result to
Success for a single render.
Properties
Result
Gets or sets the outcome of the most recent change-password operation.
public UserChangePasswordResultType Result { get; set; }
Property Value
- UserChangePasswordResultType
A UserChangePasswordResultType that the template can translate to a user-visible message. Common values include:
- Success – password changed.
- InvalidOldPassword – current password incorrect.
- MismatchedPasswords – confirmation mismatch.
- InvalidPasswordLength / InvalidPasswordComplexity – password policy violation.