Hello, I have the following script for the pasword:
void $SCR check password$ ()
{
string temp;
cultureGetString(StringIDs.PasswordString,temp,0);
if ((temp == "LVLI") || (temp == "123"))
{
sendEvent (EventIDs.TR_password_correct_lvl1);
else
{
sendEvent (EventIDs.TR_password_wrong);
}
cultureSetString(StringIDs.PasswordString,"",true);
}
void $SCR Reset password$ ()
{
cultureSetString(StringIDs.PasswordString,"",true);
}
I want to let the iser to change the password. How I can do that?
Tks in advance.
Password change by the user
- mikwin
- Posts: 7
- Joined: Thu Jan 19, 2012 3:20 pm
- ksaenz
- Enovation Controls Development
- Posts: 263
- Joined: Thu Aug 19, 2010 7:53 am
Re: Password change by the user
Hello mikwin,
You can store the password chosen by the user in a text file
And read it out to compare it when needed
Regards,
ksaenz
You can store the password chosen by the user in a text file
Code: Select all
string temp;
file f;
cultureGetString(StringIDs.PasswordString,temp,0);
if( f.open("password.txt", "w") >= 0 )
{
f.writeString( temp );
f.close();
}
Code: Select all
file f;
string validPwd;
if( f.open("password.txt", "r") >= 0 )
{
f.readLine( validPwd );
f.close();
}
else
{
validPwd = "LVLI"; // default password
}
ksaenz
- mikwin
- Posts: 7
- Joined: Thu Jan 19, 2012 3:20 pm
Re: Password change by the user
Thank you ksaenz. Ok for the script, but is that will replace or to introduced in the existting script and where?
I will send you my file, if you can help me to fix it.
I will send you my file, if you can help me to fix it.
- ksaenz
- Enovation Controls Development
- Posts: 263
- Joined: Thu Aug 19, 2010 7:53 am
Re: Password change by the user
The first piece of code should be in a script that runs after the user enters the new password to be saved.
The second piece code goes in your $SCR check password$ script before you do the comparison, you will compare to the validPwd variable instead of the hard coded strings.
You can me your code via PM and I can help you.
The second piece code goes in your $SCR check password$ script before you do the comparison, you will compare to the validPwd variable instead of the hard coded strings.
Code: Select all
if ( temp == validPwd )
{
sendEvent (EventIDs.TR_password_correct_lvl1);
}
else
{
sendEvent (EventIDs.TR_password_wrong);
}
cultureSetString(StringIDs.PasswordString,"",true);