どの領域で変化するので、チェックはありましたか? 互換性繰り返しフィールドのパスワード フィールドをチェックしたくありません。
Kohana Users Controller の追加機能
public function action_add() {
$title = 'Add User';
$this->template->title = $title;
$this->template->content = View::factory('action/users/add')
->bind('title', $title)
->bind('message', $message)
->bind('errors', $errors);
if (HTTP_Request::POST == $this->request->method()) {
try {
// Create the user using form values
$user = ORM::factory('user')->create_user($this->request->post(), array(
'username',
'password',
'email',
'last_name',
'first_name',
'middle_name'
));
// Grant user login role
$user->add('roles', ORM::factory('role', array('name' => 'login')));
// Reset values so form is not sticky
$_POST = array();
Session::instance()->set('message', "You have added user '{$user->username}' to the database");
Request::current()->redirect('/admin/' . $this->request->param('lang') . '/action/users' );
} catch (ORM_Validation_Exception $e) {
// Set failure message
$message = 'There were errors, please see form below.';
// Set errors using custom messages
$errors = $e->errors('models');
}
}
}