Previous Topic: Modify a Password Policy

Next Topic: Create Responses and Response Attributes

Manage Password State

Password state refers to activities relating to a given user's password—for example, the last time the password was changed, and the last time the password was used to log in the user.

To retrieve an existing PolicyMgtUserPasswordState object for a user, or to set a new password state object with any attribute changes, call PolicyMgtUser‑>UserPasswordState().

The table that follows lists the password state attributes you can access for a given user, and the method used to set or retrieve an attribute value. All methods are in the object PolicyMgtUserPasswordState, unless otherwise noted.

Password State Attribute

Method

Description

Login failures

LoginFailures()

Sets or retrieves the number of times the user failed to log in since the user's last successful login.

Last login time

LastLoginTime()

Sets or retrieves the time the user last logged in successfully.

Previous login time

PrevLoginTime()

Sets or retrieves the next-to-last time the user logged in successfully.

Disabled time

DisabledTime()

Sets or retrieves the time the user object was disabled.

Password history

PolicyMgtUser‑>
UserPasswordState()

Optionally, clears the user's password history when setting the password state object for the user.

You cannot retrieve password history or set password history entries.

Last password change time

LastPWChangeTime()

Sets or retrieves the time the user's password was last changed.

If you change a password state attribute, the change applies to the current password state object only. To apply the change to a password state object that may be subsequently retrieved, pass the current password state object in a call to PolicyMgtUser‑>UserPasswordState(). This method sets a new password state object containing the attribute values passed into the method.

For example, the code fragment below performs the following operations:

  1. Retrieves the password state object, $passwordstate, for the current user, $user[0].
  2. Sets the login failures attribute to 3 in this instance of the password state object.
  3. Calls UserPasswordState() to clear the user's password history and set a new password state object for the user with the new history and login failures attributes.
    $passwordstate = $user[0]‑>UserPasswordState();
    $passwordstate‑>LoginFailures(3);
    $user[0]‑>UserPasswordState($passwordstate, 1);
    


Copyright © 2010 CA. All rights reserved. Email CA about this topic