5.2.5.8 password
password (string $password)
文字列を渡すと、ハッシュ化されたものを取得できます。 この機能は、ログイン済みのユーザに対して、アプリケーションの重要な領域にアクセスさせる前にもう一度パスワードを入力してもらう時などに重要となります。
if ($this->data['User']['password'] ==
$this->Auth->password($this->data['User']['password2'])) {
// Passwords match, continue processing
...
} else {
$this->flash('Typed passwords did not match', 'users/register');
}
if ($this->data['User']['password'] ==$this->Auth->password($this->data['User']['password2'])) {// Passwords match, continue processing...} else {$this->flash('Typed passwords did not match', 'users/register');}
認証コンポーネントは、送信されたデータの中に「username」フィールドがある場合、自動的に「password」フィールドをハッシュ化します。


























