How to change the password ?

Estimated reading: 1 minute 111 views

In Visual-Guard, maintaining secure and updated user credentials is vital. The Visual-Guard .NET API provides methods to change a user’s password, either by the user themselves or by an administrator.

Here’s a brief overview of each method:

  1. User Changing Their Own Password: A user can change their own password by providing their old password and the new password they want to set.
runtime.Membership.ChangePassword("jsmith", "oldpwd", "newpwd");

Administrator Forcing a Password Change: An administrator can force a password change for a user. To do this, the VGSecurityRuntime.Principal needs to have administrator rights.

// Get the user
var user = runtime.Membership.GetUser("jsmith");

// Reset the password of the user
runtime.Membership.ForcePassword(user, "newpwd");

These methods provide flexibility in managing user credentials, allowing for both user-initiated and administrator-forced password changes.