11.30
php
saved
Oshuma
Note
Following the User Auth tutorial pretty much verbose.
http://manual.cakephp.org/appendix/simple_user_auth
Following the User Auth tutorial pretty much verbose.
http://manual.cakephp.org/appendix/simple_user_auth
- /* UsersController */
- function login() {
- // Don't show the login error by default.
- $this->set('login_error', false);
- // If a User has submitted form data.
- // Attempt to find a User with the given login name.
- $user = $this->User->findByLogin($this->data['User']['login']);
- // Check for a correct password.
- // Login successful, set the session and redirect.
- $this->Session->write('User.id', $user['User']);
- $this->flash("You have been logged in.", '/');
- } else {
- // Login failed, flag the error message.
- $this->set('login_error', true);
- }
- }
- }
Parsed in 0.051 seconds, using GeSHi 1.0.7.14