# |
Mar 8th 2018, 10:29 |
neon1024 |
Neatly wrapped for you by the framework :slightly_smiling_face: https://github.com/cakephp/cakephp/blob/master/src/Auth/DefaultPasswordHasher.php#L47 |
# |
Mar 8th 2018, 10:28 |
digitalfotografen |
Add a setPassword and a checkPassword method to your User entity |
# |
Mar 8th 2018, 10:28 |
neon1024 |
http://php.net/manual/en/function.password-hash.php |
# |
Mar 8th 2018, 10:27 |
neon1024 |
PHP even has a password function now :slightly_smiling_face: |
# |
Mar 8th 2018, 10:26 |
digitalfotografen |
@portilloster Put the password encrypt in your model, then You can reuse it from controllers and shells. But MD5 is no longer best practice for password hashing. Read the docs linked by Joshua. |
# |
Mar 8th 2018, 10:21 |
joshualuckers |
@portilloster https://book.cakephp.org/3.0/en/tutorials-and-examples/cms/authentication.html#adding-password-hashing |
# |
Mar 8th 2018, 10:17 |
slackebot |
$this->Usuarios->patchEntity($usuario, $this->request->getData()); if ($this->Usuarios->save($usuario)) { $this->Flash->success(__('The usuario has been saved.')); return $this->redirect(['action' => 'index']); } $this->Flash->error(__('The usuario could not be saved. Please, try again.')); } $this->set(compact('usuario')); } |
# |
Mar 8th 2018, 10:17 |
slackebot |
method * * @param string|null $id Usuario id. * @return \Cake\Http\Response|null Redirects on successful edit, renders view otherwise. * @throws \Cake\Network\Exception\NotFoundException When record not found. */ public function edit($id = null) { $usuario = $this->Usuarios->get($id, [ 'contain' => [] ]); if ($this->request->is(['patch', 'post', 'put'])) { $usuario = |
# |
Mar 8th 2018, 10:17 |
slackebot |
$usuario = $this->Usuarios->patchEntity($usuario, $this->request->getData()); if ($this->Usuarios->save($usuario)) { $this->Flash->success(__('The usuario has been saved.')); return $this->redirect(['action' => 'index']); } $this->Flash->error(__('The usuario could not be saved. Please, try again.')); } $this->set(compact('usuario')); } /** * Edit |
# |
Mar 8th 2018, 10:17 |
portilloster |
Hi again guys! I managed to encrypt with md5 the password on the database and also on my function login(). But I also want to encrypt the password when creating a new user or editing it. How can I manage that? I believe is adding some line on the user controller in the add and edit method but I dont know: public function add() { $usuario = $this->Usuarios->newEntity(); if ($this->request->is('post')) { |
# |
Mar 8th 2018, 09:06 |
megan |
patsuckow quality over quantity :slightly_smiling_face: |
# |
Mar 8th 2018, 08:59 |
neon1024 |
Hey everyone |
# |
Mar 8th 2018, 08:55 |
patsuckow |
Once again, I am convinced that although the cackephp community is not very large as I would like, but responsive :) |
# |
Mar 8th 2018, 08:50 |
patsuckow |
Thanks savant. The solution code was written below your tip (can anyone be useful). |
# |
Mar 8th 2018, 08:11 |
birdy247 |
morning |
# |
Mar 8th 2018, 08:07 |
savant |
night! |
# |
Mar 8th 2018, 08:07 |
savant |
otherwise there isnt anything to fetch. |
# |
Mar 8th 2018, 08:07 |
savant |
headed to bed, but basically `->fetchAll()` can only be used when you are selecting things |
# |
Mar 8th 2018, 08:07 |
savant |
I responded on stackoverflow |
# |
Mar 8th 2018, 08:02 |
patsuckow |
Hello everybody. Can anyone help me? - https://stackoverflow.com/questions/49156063/it-is-not-possible-to-know-the-output-of-execute-cakephp3-x |
# |
Mar 8th 2018, 06:40 |
ashish_onmobile |
:+1: |
# |
Mar 8th 2018, 06:40 |
ashish_onmobile |
thanks for oyur help savant |
# |
Mar 8th 2018, 06:40 |
ashish_onmobile |
got the issue |
# |
Mar 8th 2018, 06:34 |
ashish_onmobile |
ok |
# |
Mar 8th 2018, 06:34 |
savant |
your database schema is different between the two |
# |
Mar 8th 2018, 06:34 |
ashish_onmobile |
but same thing work in 5.6v |
# |
Mar 8th 2018, 06:34 |
savant |
set it to either empty string or modify your database to allow null values |
# |
Mar 8th 2018, 06:34 |
savant |
you’re trying to set a null value on a non-nullable database column |
# |
Mar 8th 2018, 06:34 |
savant |
thats a mysql error |
# |
Mar 8th 2018, 06:33 |
ashish_onmobile |
I am using cakephp 3.5 and mysql 5.7v |
# |
Mar 8th 2018, 06:33 |
ashish_onmobile |
did anyone face this problem |
# |
Mar 8th 2018, 06:33 |
ashish_onmobile |
1364 Field ‘name’ doesn’t have a default value |
# |
Mar 8th 2018, 05:08 |
dakota |
Ping me if you need any help getting it working :slightly_smiling_face: We’re using jippi’s plugin to do most of the heavy lifting |
# |
Mar 8th 2018, 05:08 |
dakota |
@davinci Their support is sometimes incredibly clueless as to what their platform actually does! We’re running CakePHP 3 with NewRelic very successfully and have been for around 2.5 years |
# |
Mar 8th 2018, 04:56 |
savant |
no problem |
# |
Mar 8th 2018, 04:56 |
meder |
that's it for today. thank you savant for your help |
# |
Mar 8th 2018, 04:56 |
meder |
i'll have to adapt that pull request for 3.3 |
# |
Mar 8th 2018, 04:53 |
meder |
and that's great :) |
# |
Mar 8th 2018, 04:52 |
meder |
haha |
# |
Mar 8th 2018, 04:52 |
savant |
we’re allowed to make code better between releases |
# |
Mar 8th 2018, 04:51 |
meder |
totally different |