Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [CakePHP]Szyfrowanie hasła
polkom21
post
Post #1





Grupa: Zarejestrowani
Postów: 47
Pomógł: 0
Dołączył: 22.07.2011

Ostrzeżenie: (0%)
-----


Siemka. Ostatnio tak jakoś wziąłem się za ogarnięcie jakiegoś frameworku i przypadło akurat na cakephp. Po kilkunastu godzinach grzebania zaczęło mi coś wychodzić. Teraz natomiast mam problem z hashowaniem hasła. W modelu mam coś takiego:
  1. App::uses('SimplePasswordHasher', 'Controller/Component/Auth');
  2.  
  3. class User extends AppModel {
  4.  
  5. public function beforeSave($options = array()) {
  6. if (!$this->id) {
  7. $passwordHasher = new SimplePasswordHasher();
  8. $this->data['User']['password'] = $passwordHasher->hash($this->data['User']['password']);
  9. }
  10. return true;
  11. }
  12.  
  13. public $components = array(
  14. 'Auth' => array(
  15. 'authenticate' => array(
  16. 'Form' => array(
  17. 'passwordHasher' => array(
  18. 'className' => 'Simple',
  19. 'hashType' => 'sha256'
  20. )
  21. )
  22. )
  23. )
  24. );

Podpowie ktoś coś co zrobić, żeby to w końcu zaczęło działać jak należy?

EDIT:
Odkryłem, że funkcja beforeSave w ogóle jest pomijana tylko pytanie czemu :/

Ten post edytował polkom21 13.08.2013, 12:10:48
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 20.08.2025 - 10:35