Page 1 of 1

problem with Decript function

Posted: Sun Jan 19, 2025 4:05 pm
by Silvio.Falconi
I noticed the problem because in an old program when I insert a user and go to save the password it saves it like this

Image

then I not understood how it save the password on field on archive

cPassw:=Encrypt(cPassw1)
oUtente:PassW :=cPassw
oUtente:save()

but when I have to convert it again to do the login check it tells me that the passwords do not match

cPasw:=Alltrim(Decrypt(oUtenti:PassW))

IF cPasw==cPass //cPass is the value insert by user
lRet:=lCont:=.T.

Re: problem with Decript function

Posted: Sun Jan 19, 2025 7:14 pm
by Antonio Linares
Dear Silvio,

Please try it this way:

cPasw = Decrypt( AllTrim( oUtenti:PassW ) )

Re: problem with Decript function

Posted: Mon Jan 20, 2025 8:20 am
by Silvio.Falconi
Antonio Linares wrote: Sun Jan 19, 2025 7:14 pm Dear Silvio,

Please try it this way:

cPasw = Decrypt( AllTrim( oUtenti:PassW ) )

I allready tested

Image

aĆ²lso with cPasw = Decrypt( AllTrim( oUtenti:PassW ) )

Re: problem with Decript function

Posted: Mon Jan 20, 2025 9:12 am
by Antonio Linares
Dear Silvio,

The field may have more spaces that the encripted string thats why we need to alltrim before

To verify that those functions work fine, try this:

MsgInfo( Decrypt( Encrypt( "Hello" ) ) )