Last active
August 29, 2015 14:05
-
-
Save johnny13/3bc72325f7bd059f69a4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Lithium: the most rad php framework | |
| * | |
| * @copyright Copyright 2013, Union of RAD (http://union-of-rad.org) | |
| * @license http://opensource.org/licenses/bsd-license.php The BSD License | |
| */ | |
| /** | |
| * This configures your session storage. The Cookie storage adapter must be connected first, since | |
| * it intercepts any writes where the `'expires'` key is set in the options array. | |
| * The default name is based on the lithium app path. Remember, if your app is numeric or has | |
| * special characters you might want to use Inflector::slug() or set this manually. | |
| */ | |
| use lithium\storage\Session; | |
| $name = basename(LITHIUM_APP_PATH); | |
| Session::config(array( | |
| // 'cookie' => array('adapter' => 'Cookie', 'name' => $name), | |
| 'default' => array('adapter' => 'Php', 'session.name' => $name) | |
| )); | |
| /* | |
| * HUI USER LOGIN SYSTEM | |
| * Default Access Controls | |
| */ | |
| use lithium\security\Auth; | |
| Auth::config(array( | |
| 'default' => array( | |
| 'adapter' => 'Form', //Specify we're using form authentication method | |
| 'model' => 'app\models\Users', //Specify what model is used for auth | |
| 'fields' => array('email', 'password'), //Specify which fields are used | |
| 'filters' => array('password' => array('lithium\util\String', 'hash')), | |
| 'validators' => array('password' => false) | |
| ) | |
| )); | |
| /** | |
| * AUTOMATICALLY START SESSION. REQUIRED FOR USER AUTHENTICATION | |
| * Set Up a System Wide Static Variable for the Web URL and the Local Path URL. | |
| **/ | |
| session_start(); | |
| if(!isset($_SESSION["weburl"])){ | |
| //$Li3WebURL = "//derek.b4lime.com/search/"; | |
| //$Li3SystemPath = "/var/www/html/search/"; | |
| //$_SESSION["weburl"] = $Li3WebURL; | |
| //$_SESSION["wwwpath"] = $Li3SystemPath; | |
| } | |
| /** | |
| * Uncomment the lines below to enable forms-based authentication. This configuration will attempt | |
| * to authenticate users against a `Users` model. In a controller, run | |
| * `Auth::check('default', $this->request)` to authenticate a user. This will check the POST data of | |
| * the request (`lithium\action\Request::$data`) to see if the fields match the `'fields'` key of | |
| * the configuration below. If successful, it will write the data returned from `Users::first()` to | |
| * the session using the default session configuration. | |
| * | |
| * Once the session data is written, you can call `Auth::check('default')` to check authentication | |
| * status or retrieve the user's data from the session. Call `Auth::clear('default')` to remove the | |
| * user's authentication details from the session. This effectively logs a user out of the system. | |
| * To modify the form input that the adapter accepts, or how the configured model is queried, or how | |
| * the data is stored in the session, see the `Form` adapter API or the `Auth` API, respectively. | |
| * | |
| * @see lithium\security\auth\adapter\Form | |
| * @see lithium\action\Request::$data | |
| * @see lithium\security\Auth | |
| */ | |
| // use lithium\security\Auth; | |
| // Auth::config(array( | |
| // 'default' => array( | |
| // 'adapter' => 'Form', | |
| // 'model' => 'Users', | |
| // 'fields' => array('username', 'password') | |
| // ) | |
| // )); | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment