Skip to content

Instantly share code, notes, and snippets.

@kirs
Created September 10, 2011 06:59
Show Gist options
  • Save kirs/1208048 to your computer and use it in GitHub Desktop.
Save kirs/1208048 to your computer and use it in GitHub Desktop.
<?php
public function actionCreate()
{
$model=new User;
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if(isset($_POST['User']))
{
$model->attributes=$_POST['User'];
// сносим хэширование
/*$model->salt = User::generateSalt();
$model->password = User::hashPassword($model->password, $model->salt);*/
if($model->save()) {
Yii::log("New user created: user_id" . Yii::app()->user->id.", insert_id:" . $model->id, "info", "application.controllers.LessonController");
Yii::app()->user->setFlash('new_user', 'Пользователь успешно добавлен. '.CHtml::link('Добавить еще?', array('user/create')));
$this->redirect(array('index'));
}
}
$this->render('create',array(
'model'=>$model,
));
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment