인증 및 ACL 구성 요소가있는 CakePHP 1.2를 사용하고 있습니다.CakePHP 인증 구성 요소가 내 비밀번호를 해킹하지 않는 이유는 무엇입니까?
내 사용자 등록 작업에서 암호가 손상되지 않습니다. 특히,이 표현 :
if ($this->data['User']['password'] !=
$this->Auth->password($this->data['User']['confirm_password']))
이 true로 평가하고, 내가 password
및 confirm_password
에 대해 동일한 값을 제출하더라도. Auth->password
에 대한 호출을 제거하면 표현식이 false로 평가되기 때문에 암호가 손상되지 않습니다.
인증 모듈이 자동으로 암호를 해시 할 것으로 예상했습니다. 내가 도대체 뭘 잘못하고있는 겁니까? 여기
<?php
echo $form->create('User', array('action' => 'register'));
echo $form->input('email',
array('after' => $form->error(
'email_unique', 'This email is already registered.')));
echo $form->input('password');
echo $form->input('confirm_password', array('type' => 'password'));
echo $form->end('Register');
?>
는 사용자의 컨트롤러에서 내 등록 작업입니다 : 여기
내보기 여기
function register(){
if ($this->data) {
if ($this->data['User']['password'] !=
$this->Auth->password($this->data['User']['confirm_password'])) {
$this->Session->setFlash(__('Password and Confirm Password must match.', true));
$this->data['User']['password'] = '';
$this->data['User']['confirm_password'] = '';
}
else{
$this->User->create();
if ($this->User->save($this->data)){
$this->redirect(array('action' => 'index'), null, true);
}
else {
$this->data['User']['password'] = '';
$this->data['User']['confirm_password'] = '';
$this->Session->setFlash(__('Some problem saving your information.', true));
}
}
}
}
그리고 내 나는 Auth
및 Acl
모듈을 포함 appController
:
class AppController extends Controller {
var $components = array('Acl', 'Auth');
function beforeFilter(){
if (isset($this->Auth)) {
$this->Auth->allow('display');
$this->Auth->fields =
array(
'username' => 'email',
'password' => 'password');
$this->Auth->authorize = 'actions';
}
}
}
내가 뭘 잘못하고 있니?
를 수정,하지만 난 한 가지에 혼란 스러워요 - 등록 할 때 암호를 해시하지 않도록 암호를 지정하는 경우 - 암호는 어떻게 작동합니까? 아니면 언제 해시 할 것입니까? – Dave