05.19
php
saved
Crazy
Note
Problem with loging in when using $this->Auth->allow('*');
Problem with loging in when using $this->Auth->allow('*');
- class AppController extends Controller {
- }
- class UsersController extends AppController {
- var $name = "Users";
- function beforeFilter() {
- $this->layout = "login";
- $this->Auth->allow('*');
- Security::setHash("md5");
- }
- function login() { }
- function logout() {
- $this->redirect($this->Auth->logout());
- $this->redirect("/");
- }
- function register() {
- $this->cleanUpFields();
- $this->data['User']['password'] = $this->Auth->password($this->data['User']['password']);
- $this->User->create();
- if ($this->User->save($this->data)) {
- $this->Session->write('User', $this->User->findByUsername($this->data['User']['username']));
- $this->Session->setFlash('Thank you for registering.');
- $this->redirect('/');
- } else {
- $this->Session->setFlash('The User could not be saved. Please, try again.');
- }
- }
- }
- }
- //View for the login form
- <div class="login">
- <h2>Login</h2>
- <div>
- <?php
- if ($session->check('Message.flash')) { $session->flash(); }
- if ($session->check('Message.auth')) { $session->flash('auth'); }
- ?>
- </div>
- </div>
- //View for the registration
- <div class="login">
- <h2>Register an Account</h2>
- <div>
- </div>
- <div>
- An account request for the admin needs to be approved. <br />
- Contact <u><b>Crazy</b></u> to activate your account
- </div>
- <div>
- </div>
- </div>
Parsed in 0.185 seconds, using GeSHi 1.0.7.14