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 | |
| //Added for prevent changes in a1_cores | |
| /** | |
| * User AUTHENTICATION module for Kohana PHP Framework using bcrypt | |
| * | |
| * bcrypt is highly recommended by many to safely store passwords. For more | |
| * information, see http://codahale.com/how-to-safely-store-a-password/ | |
| * | |
| * Based on Kohana's AUTH, Fred Wu's AUTHLITE and Woody Gilk's Bonafide | |
| * |
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
| CREATE TABLE IF NOT EXISTS `users` ( | |
| `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, | |
| `email` varchar(127) NOT NULL, | |
| `username` varchar(32) NOT NULL DEFAULT '', | |
| `password` char(80) NOT NULL, | |
| `token` char(80) NOT NULL DEFAULT '', | |
| `logins` int(10) UNSIGNED NOT NULL DEFAULT '0', | |
| `last_login` int(10) UNSIGNED, | |
| PRIMARY KEY (`id`) | |
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
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 | |
| return array( | |
| 'driver' => 'ORM', // orm/jelly/mango/sprig | |
| 'user_model' => 'user', | |
| 'cost' => 12, // Bcrypt Cost - any number between 4 and 31 -> higher = stronger hash | |
| 'cookie' => array( | |
| 'key' => 'a1_{name}_autologin', |
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 | |
| //more code | |
| /** | |
| * Enable modules. Modules are referenced by a relative or absolute path. | |
| */ | |
| Kohana::modules(array( | |
| // 'auth' => MODPATH.'auth', // Basic authentication | |
| // 'cache' => MODPATH.'cache', // Caching with multiple backends | |
| // 'codebench' => MODPATH.'codebench', // Benchmarking tool | |
| 'A1' => MODPATH.'A1', //A1 authentication |
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 defined('SYSPATH') or die('No direct script access.'); | |
| /** | |
| * Controller_Backend | |
| * | |
| * Este es el backend de una aplicacion que esta usando A1 como metodo de autenticación | |
| * | |
| * @author Javier | |
| * @package Backend | |
| * | |
| */ |
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 defined('SYSPATH') or die('No direct script access.'); | |
| /** | |
| * Controller_Account | |
| * | |
| * Aqui estaran las funcionalidades de login y registro | |
| * | |
| * @author Javier | |
| * @package Backend | |
| * | |
| */ |
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 defined('SYSPATH') or die('No direct script access.'); | |
| class Controller_Example extends Controller { | |
| public function action_index() | |
| { | |
| $view = View::factory("index") | |
| ->set("loginurl",Route::url('default',array('controller' => 'backend', 'action' => FALSE))); | |
| $this->response->body($view); | |
| } |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
| <title></title> | |
| </head> | |
| <body> | |
| <div> | |
| <h3>Ejemplo de uso de A1</h3> | |
| <p> |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
| <title></title> | |
| </head> | |
| <body> | |
| <div> | |
| <p>Bienvenido al sistema <strong><?php echo $auth->get_user()->email; ?></strong></p> | |
| <p style="float:right;"> |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
| <title></title> | |
| </head> | |
| <body> | |
| <div> | |
| <h2>Iniciar sesión</h2> | |
| <?php if(isset($errors['login'])):?> |