Login function

Discussions about product bugs & problems!
Note: This is no replacement for the Official ETM Support!
Search

Post Reply
2 posts • Page 1 of 1
AliBOUTAA
Posts: 1
Joined: Wed Feb 12, 2025 4:11 pm

Login function

Post by AliBOUTAA »

Hello, dear community

I have a question regarding my project, which was running on WinCC OA 3.12. I have a login panel that requires a username and password to open other panels. After upgrading the project to WinCC OA 3.20, I am now facing an issue where the `loginCheck()` function is no longer working. Additionally, I noticed that many files in the `libs` directory have changed.

Is there any way to fix the function or find a suitable replacement?

here is the click code of click button in my panel :

main()
{
//Autologin
EncrypDetailsCnx();

logincheck(bAllowRemoteLogin);
}


and this is the scopelib code of my panel :


#uses "CtrlCrypt.dll"

bool bDoPara;
bool useNewPt;
int iCloseModules = 1;
bool bAllowRemoteLogin=false;


string FICDETAILSAUTOLOGIN = DATA_PATH + "loginDetail";
string KEYENCRYPT = cryptoHash("ALG1sc@dA!");



void thdAutoLogin()
{
file fd;
int Err;



delay(20);


fd = fopen(FICDETAILSAUTOLOGIN, "rb");
Err = ferror(fd);

if (Err != 0) {
Log0(__FUNCTION__,__LINE__,"[ Startpanel ] Fichier '"+FICDETAILSAUTOLOGIN+"' introuvable!");
}
else {
string CryptEnrStr, DecryptEnr, Nom, Pwd, ChpPwd;
dyn_string DetailsEnr;
bool AccChpNom,AccChpPwd;
blob CryptEnr;
int LgEnr;

LgEnr = getFileSize(FICDETAILSAUTOLOGIN)+1;
blobRead(CryptEnr,LgEnr,fd);

//blobGetValue(CryptEnr, 0 ,CryptEnrStr, bloblen(CryptEnr));

desDecrypt(CryptEnr, KEYENCRYPT, DecryptEnr);


Nom = substr(DecryptEnr,0,strpos(DecryptEnr+":::",":::"));
Pwd = substr(DecryptEnr,strpos(DecryptEnr+":::",":::")+3);

getMultiValue("name" ,"enabled", AccChpNom,
"password","enabled", AccChpPwd,
"password","text" , ChpPwd);

if (AccChpNom && AccChpPwd && (ChpPwd == "")) {

setMultiValue("name" ,"text", Nom,
"password","text", Pwd);

logincheck(bAllowRemoteLogin);
}
fclose(fd);
}
}


void EncrypDetailsCnx()
{
file fd;
int Err;
string Nom, Pwd;
blob CryptEnr;


fd = fopen(FICDETAILSAUTOLOGIN, "wb");
Err = ferror(fd);

if (Err != 0) {
Log0(__FUNCTION__,__LINE__,"[ Startpanel ] Erreur sur l'écriture du fichier '"+FICDETAILSAUTOLOGIN+"'");
}
else {
string Nom;

getMultiValue("name" ,"text",Nom,
"password","text",Pwd);

desEncrypt(Nom + ":::" + Pwd, KEYENCRYPT, CryptEnr);

if (Nom != "") {
blobWrite( CryptEnr, fd );
}

fflush(fd);
fclose(fd);
}
}



string tohex(string text)
{
string Str, b;
char c;

for(int i=0; i<strlen(text); i++)
{
c = text;
sprintf(b, "%02X",c);
Str = Str + b;
}
return Str;
}





Thanks in advance!

User avatar
leoknipp
Posts: 2926
Joined: Tue Aug 24, 2010 7:28 pm

Re: Login function

Post by leoknipp »

The login functionality was changed in WinCC OA 3.16.
If you still want to use an own login panel and project specific functionality you must implement it on base of the Login Framework.
https://www.winccoa.com/documentation/W ... Cframework

Best Regards
Leopold Knipp
Senior Support Specialist

Post Reply
2 posts • Page 1 of 1