Added LogIn (pw in db)
This commit is contained in:
@@ -27,20 +27,20 @@ class ProgrammeController extends Controller
|
||||
{
|
||||
return array(
|
||||
array('allow', // allow all users to perform 'index' and 'view' actions
|
||||
'actions'=>array('index','view','create','update','admin','delete'),
|
||||
'actions'=>array('index','view'),
|
||||
'users'=>array('*'),
|
||||
),
|
||||
// array('allow', // allow authenticated user to perform 'create' and 'update' actions
|
||||
// 'actions'=>array('create','update'),
|
||||
// 'users'=>array('@'),
|
||||
// ),
|
||||
array('allow', // allow authenticated user to perform 'create' and 'update' actions
|
||||
'actions'=>array('create','update','admin','delete'),
|
||||
'users'=>array('@'),
|
||||
),
|
||||
// array('allow', // allow admin user to perform 'admin' and 'delete' actions
|
||||
// 'actions'=>array('admin','delete'),
|
||||
// 'actions'=>array(),
|
||||
// 'users'=>array('admin'),
|
||||
// ),
|
||||
// array('deny', // deny all users
|
||||
// 'users'=>array('*'),
|
||||
// ),
|
||||
array('deny', // deny everythign else to all users
|
||||
'users'=>array('*'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -106,6 +106,7 @@ class ProgrammeController extends Controller
|
||||
* Deletes a particular model.
|
||||
* If deletion is successful, the browser will be redirected to the 'admin' page.
|
||||
* @param integer $id the ID of the model to be deleted
|
||||
* @throws CHttpException on invalid request
|
||||
*/
|
||||
public function actionDelete($id)
|
||||
{
|
||||
|
||||
@@ -57,8 +57,41 @@ class SiteController extends Controller
|
||||
$data['model'] = new SendMailForm();
|
||||
}
|
||||
|
||||
|
||||
|
||||
$this->render('about', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the login page
|
||||
*/
|
||||
public function actionLogin()
|
||||
{
|
||||
$model=new LoginForm;
|
||||
|
||||
// if it is ajax validation request
|
||||
if(isset($_POST['ajax']) && $_POST['ajax']==='login-form')
|
||||
{
|
||||
echo TbActiveForm::validate($model);
|
||||
Yii::app()->end();
|
||||
}
|
||||
|
||||
// collect user input data
|
||||
if(isset($_POST['LoginForm']))
|
||||
{
|
||||
$model->attributes=$_POST['LoginForm'];
|
||||
// validate user input and redirect to the previous page if valid
|
||||
if($model->validate() && $model->login())
|
||||
$this->redirect(Yii::app()->user->returnUrl);
|
||||
}
|
||||
// display the login form
|
||||
$this->render('login', array('model'=>$model));
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs out the current user and redirect to homepage.
|
||||
*/
|
||||
public function actionLogout()
|
||||
{
|
||||
Yii::app()->user->logout();
|
||||
$this->redirect(Yii::app()->homeUrl);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user