Jump to content

Resetting account


This topic is 2807 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi!

 

I'm trying to create a script which in case of user has forgotten his/hers password resets the account with a new random password and e-mails it to recipient. Here it goes (Don't mind the dialogues, if you don't speak Finnish :) :

Show Custom Dialog [ Title: "Resetoi salasana?"; Message: "Tämä nollaa käyttäjän unohtuneen salasanan.¶¶Oletko varma, että
haluat jatkaa?"; Default Button: “Peruuta”, Commit: “Yes”; Button 2: “Resetoi!”, Commit: “Yes” ]
If [ Get ( LastMessageChoice ) = 1 ] Exit Script [ ]
End If
Set Variable [ $$pswd; Value:Middle("123456789abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ!?"; Round (Random * 61; 0)+1; 1) &
Middle("123456789abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ!?"; Round(Random * 61; 0)+1; 1) & Middle("123456789abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ!?"; Round(Random * 61; 0)+1; 1) & Middle("123456789abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ!?"; Round(Random * 61; 0)+1; 1) & Middle("123456789abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ!?"; Round(Random * 61; 0)+1; 1) & Middle("123456789abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ!?"; Round(Random * 61; 0)+1; 1) ]
Reset Account Password [ Account Name: STAFF::tUserName; New Password: $$pswd ] [ Expire password ]
Send Mail [ Send via SMTP Server; To: STAFF::teMail; Subject: "Salasana resetoitu"; Message: "Salasanasi on nyt resetoitu" & ¶
& ¶&
"Uusi salasanasi on: " & $$pswd & ¶ & ¶&
"Huomioi, että järjestelmä erottelee pienet ja isot kirjaimet" & ¶ &
"Salasana tulee muuttaa ensimmäisellä sisäänkirjautumisella järjestelmään"; Name: "Administrator"; Email Address: "[email protected]"; Reply-To Address: "[email protected]"; SMTP Server: CAL:: tgMailServer; Port: CAL::tgMailAccountPortNmbr; Use SSL; Authentication Type: Plain Password; User Name: CAL:: tgMailAccountName; Password: CAL::tgMailAccountPswd ]
[ No dialog ]
Show Custom Dialog [ Title: "Resetoitu"; Message: "Käyttäjän " & STAFF::cLastFirstName & " salasana on nyt resetoitu.¶ Uusi salasana on: " & $$pswd & ¶ &
"Käyttäjän tulee vaihtaa salasana, kun kirjautuu seuraavan kerran järjestelmään."; Default Button: “OK”, Commit: “Yes” ]
Commit Records/Requests
[ Skip data entry validation; No dialog ]

But I keep getting error code 5 (Command is invalid (for example, a Set Field script step does not have a calculation specified)) every time in step "Reset Account" and the account fails to be resetted to new password. I also tried to create a text field where new random password is temporarily stored and then used is Reset accoount step but without success. If I use a "static" new password in that step (for example: "New Password" every time), it works.

 

What is wrong in that script or can I get around this some how?

 

Thanks again in advance!

Link to comment
Share on other sites

The exact error message (in Debugger window) is that "Last error: 5". During the script (when not debugging) there is no error signals. E-mailing works, but the account does not reset (i.e. new password does not work, only the old).

Link to comment
Share on other sites

I cannot reproduce your problem. Does the attached file work for you?

 

ResetPassword.fp7.zip

 

 

Unrelated to your problem, but important:

The variable holding the temporary password should be local ($pswd), not global ($$pswd). Global variables persist until the end of the session - and that poses a security risk in this case. The variable should expire when the script exits.

 

BTW, the Commit Records step is redundant, since you're not modifying any records.

 

 

 

 

 

 

  • Like 1
Link to comment
Share on other sites

Ok... Actually it seems that problem was in STAFF::tUserName field because for some reason it was left empty in my data. Comment's test file worked perfectly. And now this resetting works also in my file.

I used $$pswd only to test if that was the reason. Now it is changed back to $pswd.

 

Thank you so much for your help!

Link to comment
Share on other sites

This topic is 2807 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.