Page 1 of 1

how to create MD5 field in appgini ?

Posted: 2022-12-09 15:18
by zkarwinkar
i need to create MD5 field in appgini , please help.

Re: how to create MD5 field in appgini ?

Posted: 2022-12-09 21:23
by pbottcher
Hi, can you provide a little bit more information about what you try. You can use the PHP md5() function or the MYSQL function md5() function.

Re: how to create MD5 field in appgini ?

Posted: 2022-12-10 17:24
by zkarwinkar
i have password field from another custom application that i linked it to appgini app.
all users_table will be handled by appgini app.
is there any solution for it? to update create user with md5 password field?

Re: how to create MD5 field in appgini ?

Posted: 2022-12-10 17:28
by jsetzer
(a) Do you just want to save a string, md5-encrypted, in one of your AppGini generated tables or

(b) do you want to overwrite AppGini user's passwords with md5-encrypted strings stored in a different database?

More information, please!

Re: how to create MD5 field in appgini ?

Posted: 2022-12-10 17:33
by zkarwinkar
a

Re: how to create MD5 field in appgini ?

Posted: 2022-12-10 17:38
by zkarwinkar
option (a)
i want to save a string md5-encrypted.

Re: how to create MD5 field in appgini ?

Posted: 2022-12-10 18:40
by jsetzer
There are several tasks:

(1) As mentioned before by pböttcher, you can use PHP's (or MySQL's) md5 function in before_insert and before_update hook for encrypting user input and storing it in DB. Just read the plain text password within $data array, encrypt it, then store it:
$data['textMd5'] = md5($data['text']);
That sample requires both fields (text and textMd5) available in DV, NOT readonly

Cution: don't encrypt already encrypted values again. What I mean: if you only have one field, don't encrypt the value over and over again on every save.

(2) if you need to hide any value in UI behind *******, you should use jQuery('#text').attr('type', 'password'); in hooks/TABLENAME-dv.js.
If you have two fields, you may want to hide the 2nd field: jQuery('#textMd5').closest('.form-group').hide();

Re: how to create MD5 field in appgini ?

Posted: 2022-12-10 18:46
by zkarwinkar
thank you Sir.