How to force all users of a specific type to change their password upon login.


1. Identify the records to update

  • Test the query with a SELECT statement first, adjusting to the desired user type
    Example:
    SELECT * FROM UGN WHERE DEL = 0 AND UTY IN ('user', 'teacher')
    


2. Set UGN.CPW to 1

  • Backup the UGN table before making changes
  • Update the records 
    Example:
    UPDATE UGN SET CPW = 1 WHERE DEL = 0 AND UTY IN ('user', 'teacher')


  • UPDATE UGN: Targets the UGN table, which stores user account information.
  • WHERE DEL = 0: Ensures only active (non-deleted) user records are updated. The DEL field typically indicates deletion status, where 0 means the record is active.
  • SET CPW = 1: Sets the CPW (Change Password) flag to 1, indicating that the user must change their password at next login.
  • WHERE UTY IN ('user', 'teacher'): Filters the update to only apply to users whose UTY (User Type) is either 'user' or 'teacher'.