AnsweredAssumed Answered

How to reset an account password using scripts while the current account password is expired?

Question asked by Siroos Jafary on May 31, 2018
Latest reply on Jun 6, 2018 by Siroos Jafary

Hi all,


I have a solution that users need to be able to reset their own password. I wrote a script (below) to grab their account name and generate a random password.


Then reset account's password using the "Reset Account Password" script step with "User must change password on next sign in" checked.


Right after that, I have a Re-login script so it prompts for typing a new password.

So far, so good, the popup appears and user can input new password then log in.


The problem is that if, for what ever reason, the user close the popup before entering new password (or FileMaker crashes), FileMaker would expire the random password which is set in previous step. From then, when ever a script tries to reset the password, it fails with no error.


If I try to log in, I receive error 211:  "Password has expired".


So I wonder if there is a way to reset the expired password by scripts? Or any work around except opening the FileMaker security window and manually resetting the password?


Here is a copy of script:


Show Custom Dialog [ Title: "Reset Password"; Message: "Are you sure you want to reset the password for this account?"; Default Button:“Yes”, Commit: “Yes”; Button 2: “Cancel”, Commit: “No” ]

If [ Get ( LastMessageChoice ) = 1 ]

Set Variable [ $Account; Value:Account ]

Set Variable [ $Password; Value:Password ]

Reset Account Password [ Account Name: $Account; New Password: $Password ][ Expire password ]


Re-Login [ Account Name: $Account; Password: $Password ][ No dialog ]

Exit Loop If [ Get(LastError) = 0 ]

Show Custom Dialog [ Title: "Error!" & " " & Get(LastError); Message: "Something went wrong! Please contact administrator.";Default Button: “Retry”, Commit: “Yes”; Button 2: “Close file”, Commit: “No” ]

If [ Get(LastMessageChoice) <> 1 ]

Close File [ Current File ]

End If

End Loop

End If