Como enviar/save senha codificada SHA1 (How Submit/Save password SHA1 in to database)

Como enviar/save senha codificada SHA1 (How Submit/Save password SHA1 in to database)

freemasterfreemaster Posts: 3Questions: 2Answers: 0
edited February 2016 in Editor

Olá, criei o campo senha na inclusão de usuários....eu preciso que o usuário digite a senha (sem codificação), e quando for salvar o banco da dados essa senha seja convertida para SHA1. Como posso fazer isso?


Hello, I created the password field in adding users .... I need the user to enter the password (no coding), and when you save into database that password be converted to SHA1. How can I do this?

Answers

  • allanallan Posts: 61,776Questions: 1Answers: 10,112 Site admin

    Hi,

    There is an explanation of how this might be done in the DataTables blog. It uses Editor's server-side events to make this possible.

    Allan

  • allanallan Posts: 61,776Questions: 1Answers: 10,112 Site admin

    You'll also want to use a set formatter to SHA1 encode the password.

    Allan

  • freemasterfreemaster Posts: 3Questions: 2Answers: 0

    understand...
    I need to do this !?

    'Password' => sha1($password)

    (in preCreat and preEdit , correct!?)

  • allanallan Posts: 61,776Questions: 1Answers: 10,112 Site admin

    You would do that part in the set formatter. You would use the events to decide if the set formatter should be applied at all. For example you don't want to set the user's password to sha1("") if they submit an empty string (i.e. no change)!

    Allan

This discussion has been closed.