|
hi to all,
i have created two tables one is users, two is admin_users. these tables have taken same fields like(username,password,email). when i hit the url like http://localhost//admin_users/login.am struggled dis one. i did not login through url. if anyone know please help me. thanks, rajakumar. my code is : App controller: public $components = array( 'Session', 'Auth' => array( 'loginRedirect' => array('controller' => 'adminusers', 'action' => 'index'), 'logoutRedirect' => array('controller' => 'pages', 'action' => 'display', 'home'), 'authorize' => array('Controller') // Added this line ) ); admin_users controller: public function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow( 'add');
public function login() {
if($this->request->is('post')){
if($this->Auth->login()){
$this->redirect(array ("controller" => "adminusers", "action" => "index"));
} else {
if($this->request->is('post')){
$this->Session->setFlash(__('Invalid username or password, try again'));
}
}
}
}
public function logout() {
$this->redirect($this->Auth->logout());
}
login.ctp <div class="adminUsers form">
<?php echo $this->Session->flash('auth'); ?>
<?php echo $this->Form->create('AdminUSer'); ?>
<fieldset>
<legend><?php echo __('Please enter your username and password'); ?></legend>
<?php
echo $this->Form->input('username');
echo $this->Form->input('password');
?>
</fieldset>
<?php echo $this->Form->end(__('Login')); ?>
</div> You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [hidden email]. To unsubscribe from this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/cake-php?hl=en-US. |
|
i think, you need this (
http://book.cakephp.org/2.0/en/tutorials-and-examples/simple-acl-controlled-application/simple-acl-controlled-application.html ) and not 2 tables and all..
-- Lep pozdrav, Tilen Majerle 2012/8/21 raj kumar Pustela <[hidden email]> hi to all, -- You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [hidden email]. To unsubscribe from this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/cake-php?hl=en-US. |
|
no real need for ACL, or 2 seperate tables that I can see.
Add a field to users called "role" then use isAuthorized() to allow access to the admin sections if role == admin ACL would be useful if you had LOTS of roles and wanted a way to manage them in a hierarchy - but if you just want to discriminate between a couple of distinct classes of users, role + isAuthorized is easier... On Tue, Aug 21, 2012 at 6:05 PM, Tilen Majerle <[hidden email]> wrote: i think, you need this ( http://book.cakephp.org/2.0/en/tutorials-and-examples/simple-acl-controlled-application/simple-acl-controlled-application.html ) and not 2 tables and all.. -- You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [hidden email]. To unsubscribe from this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/cake-php?hl=en-US. |
|
or do like Greg said...good option :)
-- Lep pozdrav, Tilen Majerle 2012/8/21 Greg Skerman <[hidden email]> no real need for ACL, or 2 seperate tables that I can see. -- You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [hidden email]. To unsubscribe from this group, send email to [hidden email]. Visit this group at http://groups.google.com/group/cake-php?hl=en-US. |
| Powered by Nabble | Edit this page |
