Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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!

What is the exact error message you get (a screenshot would be most helpful, unless your application is giving them in Finnish)?

  • Author

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).

When you debug the script, at what step exactly does error 5 show up?

  • Author

Right after I commit line: Reset Account Password [ Account Name: STAFF::tUserName; New Password: $pswd ] [ Expire password ]

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.

 

 

 

 

 

 

  • Author

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!

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.