W czym tkwi mój problem? Nie wiadomo jakim cudem cudem w users/login hashują mi się hasła, w niejasny dla mnie sposób.
Sam fakt hashowania w login mnie nie martwi, za to martwi fakt iż jest on tylko w funkcji login, przez co po rejestracji nie mogę się zalogować. Kombinowałem manualnie z hashowaniem, jednak rezultaty nie były zbieżne z tym co wyczyniał login. Próbowałem wyłączyć to hashowanie, jednak starania spełzły na niczym.
Używam cake w wersji 2.1 Stable
Na stronie CakePHP jest napisane:
"In basic authentication, the username and password are transmitted as plain-text to the server."
Więc napisałem sobie w beforeFilter() tak:
Więc teoretycznie nie powinno mi automatycznie hashować. Tylko teoretycznie, w praktyce hashuje (tylko hasło i tylko w login)nadal, mimo prób dawania samego Form, tudzież Basic, zmieniania kolejności itp. Próbowałem również metody polegającej na nadpisaniu funkcji hashPasswords w modelu User.
function hashPasswords($data){ debug($data); return $data; // to raczej nie powinno hashować :) }
Bezzskutecznie.
W sumie już nie wiem co robić, nie mam dużego doświadczenia w CakePHP, dlatego radzę się was. Żeby rozjaśnić sytuację dodam co ważniejsze pliki:
Funkcja login i beforeFilter z controllera UserController:
function beforeFilter() { //$this->Auth->authenticate = ClassRegistry::init('User'); $this->Auth->allow('index', 'register', 'login'); $this->Auth->authError = "blond jakis"; $this->Auth->authorize = 'Controller'; } function login(){ if ($this->request->is('post')) { if ($this->Auth->login()) { return $this->redirect($this->Auth->redirect()); } else { } } } function logout(){ $this->Session->setFlash("Wylogowalem"); $this->redirect($this->Auth->logout()); } function register(){ if ($this->request->is('post')) { $this->request->data['User']['password'] = AuthComponent::password($this->request->data['password']); if ($this->User->save($this->request->data)) { //$this->set('dane', $this->request->data); return $this->redirect('/users/'); } else { } }
Widoczek:
<?php ?>
Kod może elegancki nie jest, ale zrobiłem go w celach edukacyjnych,
Z góry dziękuję za pomoc, będę wdzięczny za choćby najmniejsze zainteresowanie sprawą.

Pozdrawiam.