how to create MD5 field in appgini ?

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
zkarwinkar
Veteran Member
Posts: 32
Joined: 2021-06-12 21:01

how to create MD5 field in appgini ?

Post by zkarwinkar » 2022-12-09 15:18

i need to create MD5 field in appgini , please help.

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: how to create MD5 field in appgini ?

Post by pbottcher » 2022-12-09 21:23

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.
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

zkarwinkar
Veteran Member
Posts: 32
Joined: 2021-06-12 21:01

Re: how to create MD5 field in appgini ?

Post by zkarwinkar » 2022-12-10 17:24

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?

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: how to create MD5 field in appgini ?

Post by jsetzer » 2022-12-10 17:28

(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!
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

zkarwinkar
Veteran Member
Posts: 32
Joined: 2021-06-12 21:01

Re: how to create MD5 field in appgini ?

Post by zkarwinkar » 2022-12-10 17:33

a

zkarwinkar
Veteran Member
Posts: 32
Joined: 2021-06-12 21:01

Re: how to create MD5 field in appgini ?

Post by zkarwinkar » 2022-12-10 17:38

option (a)
i want to save a string md5-encrypted.

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts: 1807
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: how to create MD5 field in appgini ?

Post by jsetzer » 2022-12-10 18:40

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();
Kind regards,
<js />

My AppGini Blog:
https://appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability

AppGini 24.10 Revision 1579 + all AppGini Helper tools

zkarwinkar
Veteran Member
Posts: 32
Joined: 2021-06-12 21:01

Re: how to create MD5 field in appgini ?

Post by zkarwinkar » 2022-12-10 18:46

thank you Sir.

Post Reply