Class UserChangePasswordViewModelExtensions
- Namespace
- Dynamicweb.Users.Frontend.UserChangePassword
- Assembly
- Dynamicweb.Users.dll
Extension methods for UserChangePasswordViewModel.
public static class UserChangePasswordViewModelExtensions
- Inheritance
-
UserChangePasswordViewModelExtensions
- Inherited Members
Examples
Simple C# usage:
var url = model.GetChangePasswordLink(123);
Console.WriteLine(url); // "/?ID=123&Cmd=ChangePassword"
Razor template usage:
@inherits ViewModelTemplate<Dynamicweb.Users.Frontend.UserChangePassword.UserChangePasswordViewModel> @using Dynamicweb.Users.Frontend.UserChangePassword
var actionUrl = Model.GetChangePasswordLink(Pageview.Page.ID);
<form method="post" action="@actionUrl"> <!-- password fields here --> <button type="submit">Change password</button> </form>
Remarks
These helpers simplify generating links for the change password workflow.
The most common usage is calling GetChangePasswordLink(UserChangePasswordViewModel, int)
from within a Razor template to produce a form action URL that triggers the module's
password-change handling logic.
Methods
GetChangePasswordLink(UserChangePasswordViewModel, int)
Builds the change password action URL for the given page and model.
public static string? GetChangePasswordLink(this UserChangePasswordViewModel model, int pageId)
Parameters
modelUserChangePasswordViewModelThe UserChangePasswordViewModel instance from the template.
May benull(in which case the method also returnsnull).pageIdintThe numeric ID of the page hosting the
UserChangePasswordmodule.
Typically retrieved withPageview.Page.IDinside Razor.
Returns
- string
A fully formed relative URL such as
/?ID=123&Cmd=ChangePasswordif the model is not null;
otherwise,null.
Remarks
The generated link always includes the query string ?Cmd=ChangePassword.
The module only processes password change attempts on POST requests to this URL.