Ed,
This will work fine for a user who has never had force password set before.
But for a user who already has this setting in place, this could cause issues. The insert should throw an error - well, *hopefully* it will throw an error, since otherwise you would have two entries for the same setting for the same user which may have different values and who knows how the login process will handle those multiple rows.
When the value is set to 1, the user is forced to change the password on the next login. After they successfully do that, this value is is reset to 0 and the row is not removed from the table. Users who have never had a forced password reset will have no row at all in the table for this yet. You can see this yourself in the database by noting how few users will have this setting, and any with a 0 have had the password forced sometime in the past.
So, your code here would need to check if the user already has this setting in the table (ie is not null) and 1) if so, set the value to 1 if is 0, or 2) if not, then do the insert.
Randy
This will work fine for a user who has never had force password set before.
But for a user who already has this setting in place, this could cause issues. The insert should throw an error - well, *hopefully* it will throw an error, since otherwise you would have two entries for the same setting for the same user which may have different values and who knows how the login process will handle those multiple rows.
When the value is set to 1, the user is forced to change the password on the next login. After they successfully do that, this value is is reset to 0 and the row is not removed from the table. Users who have never had a forced password reset will have no row at all in the table for this yet. You can see this yourself in the database by noting how few users will have this setting, and any with a 0 have had the password forced sometime in the past.
So, your code here would need to check if the user already has this setting in the table (ie is not null) and 1) if so, set the value to 1 if is 0, or 2) if not, then do the insert.
Randy