├── .gitignore ├── README.md ├── application ├── config │ └── authme.php ├── controllers │ └── auth.php ├── helpers │ └── authme_helper.php ├── libraries │ └── authme.php ├── models │ └── authme_model.php ├── vendor │ └── PasswordHash.php └── views │ └── auth │ ├── forgot_password.php │ ├── login.php │ ├── reset_password.php │ └── signup.php └── license.txt /.gitignore: -------------------------------------------------------------------------------- 1 | system/* 2 | .htaccess 3 | index.php 4 | application/views/welcome_message.php 5 | *.html 6 | application/config/autoload.php 7 | application/config/config.php 8 | application/config/constants.php 9 | application/config/database.php 10 | application/config/doctypes.php 11 | application/config/foreign_chars.php 12 | application/config/hooks.php 13 | application/config/migration.php 14 | application/config/mimes.php 15 | application/config/profiler.php 16 | application/config/routes.php 17 | application/config/smileys.php 18 | application/config/user_agents.php 19 | application/controllers/welcome.php 20 | application/errors/error_404.php 21 | application/errors/error_db.php 22 | application/errors/error_general.php 23 | application/errors/error_php.php -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | CodeIgniter Authme 2 | ================== 3 | 4 | A lightweight, flexible and secure CodeIgniter authentication library. It uses PHPass for secure password hashing and aims to be a solid base on which to build an authentication system for your CodeIgniter project. It comes packaged with an example `Auth` class and related views so that you can get your CI project up and running in minutes. 5 | 6 | Requirements 7 | ------------ 8 | 9 | * CodeIgniter 2.1+ 10 | * PHP 5.2+ 11 | * MySQL 12 | 13 | Installation 14 | ------------ 15 | 16 | 1. Download and unpack the contents of the application folder to your CodeIgniter project. 17 | 2. That's it! Visit `/auth` to signup and login. 18 | 3. If you want you can edit `application/config/authme.php` to change some settings, but the defaults are fine. 19 | 20 | Usage 21 | ----- 22 | 23 | For an example on how to use Authme see the [example Auth controller](application/controllers/auth.php) which provides a functioning example of login, sign up, logout and forget/reset password. The Authme library provides several API methods: 24 | 25 | `logged_in()` - Returns `true` if the current user logged in, `false` otherwise. 26 | 27 | `login($email, $password)` - Attempts to login a user with a given `$email` and `$password`. Returns `true` if successful and `false` otherwise. 28 | 29 | `logout([$redirect = false])` - Logs out the current user (by destorying the session). Accepts an optional `$redirect` parameter to redirect to a given URI after logout. 30 | 31 | `signup($email, $password)` - Attempts to create a user with a given `$email` and `$password`. Returns `true` if successful and `false` otherwise. 32 | 33 | `reset_password($user_id, $new_password)` - Resets the password of the user with the given `$user_id`. 34 | 35 | The [Authme helper](application/helpers/authme_helper.php) includes the following helper functions: 36 | 37 | `logged_in()` - Returns `true` if the current user logged in, `false` otherwise (shortcut to the Authme library `logged_in()` function). 38 | 39 | `user([$key = ''])` - Returns the session data for the currently logged in user. If you specifiy a `$key` you can retrieve specific info, for exmaple `user('id')` returns the currently logged in user ID. 40 | 41 | Credits 42 | ------- 43 | 44 | The CodeIgniter Authme library was created by [Gilbert Pellegrom](http://gilbert.pellegrom.me) from [Dev7studios](http://dev7studios.com). Released under the MIT license. 45 | 46 | Please contribute by [reporting bugs](https://github.com/gilbitron/CodeIgniter-Authme/issues) and submitting [pull requests](https://github.com/gilbitron/CodeIgniter-Authme/pulls). 47 | -------------------------------------------------------------------------------- /application/config/authme.php: -------------------------------------------------------------------------------- 1 | load->library('authme'); 19 | $this->load->helper('authme'); 20 | $this->config->load('authme'); 21 | 22 | $this->load->helper('url'); 23 | } 24 | 25 | public function index() 26 | { 27 | if(!logged_in()) redirect('auth/login'); 28 | 29 | // Redirect to your logged in landing page here 30 | redirect('auth/dash'); 31 | } 32 | 33 | /** 34 | * Login page 35 | */ 36 | public function login() 37 | { 38 | // Redirect to your logged in landing page here 39 | if(logged_in()) redirect('auth/dash'); 40 | 41 | $this->load->library('form_validation'); 42 | $this->load->helper('form'); 43 | $data['error'] = false; 44 | 45 | $this->form_validation->set_rules('email', 'Email', 'required|valid_email'); 46 | $this->form_validation->set_rules('password', 'Password', 'required'); 47 | 48 | if($this->form_validation->run()){ 49 | if($this->authme->login(set_value('email'), set_value('password'))){ 50 | // Redirect to your logged in landing page here 51 | redirect('auth/dash'); 52 | } else { 53 | $data['error'] = 'Your email address and/or password is incorrect.'; 54 | } 55 | } 56 | 57 | $this->load->view('auth/login', $data); 58 | } 59 | 60 | /** 61 | * Signup page 62 | */ 63 | public function signup() 64 | { 65 | // Redirect to your logged in landing page here 66 | if(logged_in()) redirect('auth/dash'); 67 | 68 | $this->load->library('form_validation'); 69 | $this->load->helper('form'); 70 | $data['error'] = ''; 71 | 72 | $this->form_validation->set_rules('email', 'Email', 'required|valid_email|is_unique['. $this->config->item('authme_users_table') .'.email]'); 73 | $this->form_validation->set_rules('password', 'Password', 'required|min_length['. $this->config->item('authme_password_min_length') .']'); 74 | $this->form_validation->set_rules('password_conf', 'Confirm Password', 'required|matches[password]'); 75 | 76 | if($this->form_validation->run()){ 77 | if($this->authme->signup(set_value('email'), set_value('password'))){ 78 | $this->authme->login(set_value('email'), set_value('password')); 79 | 80 | // Do some post signup stuff like send a welcome email... 81 | 82 | // Redirect to your logged in landing page here 83 | redirect('auth/dash'); 84 | } else { 85 | $data['error'] = 'Failed to sign up with the given email address and password.'; 86 | } 87 | } 88 | 89 | $this->load->view('auth/signup', $data); 90 | } 91 | 92 | /** 93 | * Logout page 94 | */ 95 | public function logout() 96 | { 97 | if(!logged_in()) redirect('auth/login'); 98 | 99 | // Redirect to your logged out landing page here 100 | $this->authme->logout('/'); 101 | } 102 | 103 | /** 104 | * Example dashboard page 105 | */ 106 | public function dash() 107 | { 108 | if(!logged_in()) redirect('auth/login'); 109 | 110 | echo 'Hi, '. user('email') .'. You have successfully logged in. Logout'; 111 | } 112 | 113 | /** 114 | * Forgot password page 115 | */ 116 | public function forgot() 117 | { 118 | // Redirect to your logged in landing page here 119 | if(logged_in()) redirect('auth/dash'); 120 | 121 | $this->load->library('form_validation'); 122 | $this->load->helper('form'); 123 | $data['success'] = false; 124 | 125 | $this->form_validation->set_rules('email', 'Email', 'required|valid_email|callback_email_exists'); 126 | 127 | if($this->form_validation->run()){ 128 | $email = $this->input->post('email'); 129 | $this->load->model('Authme_model'); 130 | $user = $this->Authme_model->get_user_by_email($email); 131 | $slug = md5($user->id . $user->email . date('Ymd')); 132 | 133 | $this->load->library('email'); 134 | $this->email->from('noreply@example.com', 'Example App'); // Change these details 135 | $this->email->to($email); 136 | $this->email->subject('Reset your Password'); 137 | $this->email->message('To reset your password please click the link below and follow the instructions: 138 | 139 | '. site_url('auth/reset/'. $user->id .'/'. $slug) .' 140 | 141 | If you did not request to reset your password then please just ignore this email and no changes will occur. 142 | 143 | Note: This reset code will expire after '. date('j M Y') .'.'); 144 | $this->email->send(); 145 | 146 | $data['success'] = true; 147 | } 148 | 149 | $this->load->view('auth/forgot_password', $data); 150 | } 151 | 152 | /** 153 | * CI Form Validation callback that checks a given email exists in the db 154 | * 155 | * @param string $email the submitted email 156 | * @return boolean returns false on error 157 | */ 158 | public function email_exists($email) 159 | { 160 | $this->load->model('Authme_model'); 161 | 162 | if($this->Authme_model->get_user_by_email($email)){ 163 | return true; 164 | } else { 165 | $this->form_validation->set_message('email_exists', 'We couldn\'t find that email address in our system.'); 166 | return false; 167 | } 168 | } 169 | 170 | /** 171 | * Reset password page 172 | */ 173 | public function reset() 174 | { 175 | // Redirect to your logged in landing page here 176 | if(logged_in()) redirect('auth/dash'); 177 | 178 | $this->load->library('form_validation'); 179 | $this->load->helper('form'); 180 | $data['success'] = false; 181 | 182 | $user_id = $this->uri->segment(3); 183 | if(!$user_id) show_error('Invalid reset code.'); 184 | $hash = $this->uri->segment(4); 185 | if(!$hash) show_error('Invalid reset code.'); 186 | 187 | $this->load->model('Authme_model'); 188 | $user = $this->Authme_model->get_user($user_id); 189 | if(!$user) show_error('Invalid reset code.'); 190 | $slug = md5($user->id . $user->email . date('Ymd')); 191 | if($hash != $slug) show_error('Invalid reset code.'); 192 | 193 | $this->form_validation->set_rules('password', 'Password', 'required|min_length['. $this->config->item('authme_password_min_length') .']'); 194 | $this->form_validation->set_rules('password_conf', 'Confirm Password', 'required|matches[password]'); 195 | 196 | if($this->form_validation->run()){ 197 | $this->authme->reset_password($user->id, $this->input->post('password')); 198 | $data['success'] = true; 199 | } 200 | 201 | $this->load->view('auth/reset_password', $data); 202 | } 203 | 204 | } -------------------------------------------------------------------------------- /application/helpers/authme_helper.php: -------------------------------------------------------------------------------- 1 | load->library('authme'); 16 | 17 | return $CI->authme->logged_in(); 18 | } 19 | 20 | function user($key = '') 21 | { 22 | $CI =& get_instance(); 23 | $CI->load->library('session'); 24 | 25 | $user = $CI->session->userdata('user'); 26 | if($key && isset($user->$key)) return $user->$key; 27 | return $user; 28 | } 29 | 30 | /* End of file: authme_helper.php */ 31 | /* Location: application/helpers/authme_helper.php */ -------------------------------------------------------------------------------- /application/libraries/authme.php: -------------------------------------------------------------------------------- 1 | CI =& get_instance(); 23 | 24 | $this->CI->load->database(); 25 | $this->CI->load->library('session'); 26 | $this->CI->load->model('authme_model'); 27 | $this->CI->config->load('authme'); 28 | 29 | include($path); 30 | $this->PasswordHash = new PasswordHash(8, $this->CI->config->item('authme_portable_hashes')); 31 | } 32 | 33 | public function logged_in() 34 | { 35 | return $this->CI->session->userdata('logged_in'); 36 | } 37 | 38 | public function login($email, $password) 39 | { 40 | $user = $this->CI->authme_model->get_user_by_email($email); 41 | if($user){ 42 | if($this->PasswordHash->CheckPassword($password, $user->password)){ 43 | unset($user->password); 44 | $this->CI->session->set_userdata(array( 45 | 'logged_in' => true, 46 | 'user' => $user 47 | )); 48 | $this->CI->authme_model->update_user($user->id, array('last_login' => date('Y-m-d H:i:s'))); 49 | return true; 50 | } 51 | } 52 | 53 | return false; 54 | } 55 | 56 | public function logout($redirect = false) 57 | { 58 | $this->CI->session->sess_destroy(); 59 | if($redirect){ 60 | $this->CI->load->helper('url'); 61 | redirect($redirect, 'refresh'); 62 | } 63 | } 64 | 65 | public function signup($email, $password) 66 | { 67 | $user = $this->CI->authme_model->get_user_by_email($email); 68 | if($user) return false; 69 | 70 | $password = $this->PasswordHash->HashPassword($password); 71 | $this->CI->authme_model->create_user($email, $password); 72 | return true; 73 | } 74 | 75 | public function reset_password($user_id, $new_password) 76 | { 77 | $new_password = $this->PasswordHash->HashPassword($new_password); 78 | $this->CI->authme_model->update_user($user_id, array('password' => $new_password)); 79 | } 80 | 81 | } 82 | 83 | /* End of file: authme.php */ 84 | /* Location: application/libraries/authme.php */ -------------------------------------------------------------------------------- /application/models/authme_model.php: -------------------------------------------------------------------------------- 1 | load->database(); 21 | $this->config->load('authme'); 22 | 23 | $this->users_table = $this->config->item('authme_users_table'); 24 | 25 | if(!$this->db->table_exists($this->users_table)) $this->create_users_table(); 26 | } 27 | 28 | public function get_user($user_id) 29 | { 30 | $query = $this->db->get_where($this->users_table, array('id' => $user_id)); 31 | if($query->num_rows()) return $query->row(); 32 | return false; 33 | } 34 | 35 | public function get_user_by_email($email) 36 | { 37 | $query = $this->db->get_where($this->users_table, array('email' => $email)); 38 | if($query->num_rows()) return $query->row(); 39 | return false; 40 | } 41 | 42 | public function get_users($order_by = 'id', $order = 'asc', $limit = 0, $offset = 0) 43 | { 44 | $this->db->order_by($order_by, $order); 45 | if($limit) $this->db->limit($limit, $offset); 46 | $query = $this->db->get($this->users_table); 47 | return $query->result(); 48 | } 49 | 50 | public function get_user_count() 51 | { 52 | return $this->db->count_all($this->users_table); 53 | } 54 | 55 | public function create_user($email, $password) 56 | { 57 | $data = array( 58 | 'email' => filter_var($email, FILTER_SANITIZE_EMAIL), 59 | 'password' => $password, // Should be hashed 60 | 'created' => date('Y-m-d H:i:s') 61 | ); 62 | $this->db->insert($this->users_table, $data); 63 | return $this->db->insert_id(); 64 | } 65 | 66 | public function update_user($user_id, $data) 67 | { 68 | $this->db->where('id', $user_id); 69 | $this->db->update($this->users_table, $data); 70 | } 71 | 72 | public function delete_user($user_id) 73 | { 74 | $this->db->delete($this->users_table, array('id' => $user_id)); 75 | } 76 | 77 | private function create_users_table() 78 | { 79 | $this->load->dbforge(); 80 | $this->dbforge->add_field('id INT(11) NOT NULL AUTO_INCREMENT'); 81 | $this->dbforge->add_field('email VARCHAR(200) NOT NULL'); 82 | $this->dbforge->add_field('password VARCHAR(200) NOT NULL'); 83 | $this->dbforge->add_field('created DATETIME NOT NULL'); 84 | $this->dbforge->add_field('last_login DATETIME NOT NULL'); 85 | $this->dbforge->add_key('id', true); 86 | $this->dbforge->create_table($this->users_table); 87 | } 88 | 89 | } 90 | 91 | /* End of file: authme_model.php */ 92 | /* Location: application/models/authme_model.php */ -------------------------------------------------------------------------------- /application/vendor/PasswordHash.php: -------------------------------------------------------------------------------- 1 | in 2004-2006 and placed in 8 | # the public domain. Revised in subsequent years, still public domain. 9 | # 10 | # There's absolutely no warranty. 11 | # 12 | # The homepage URL for this framework is: 13 | # 14 | # http://www.openwall.com/phpass/ 15 | # 16 | # Please be sure to update the Version line if you edit this file in any way. 17 | # It is suggested that you leave the main version number intact, but indicate 18 | # your project name (after the slash) and add your own revision information. 19 | # 20 | # Please do not change the "private" password hashing method implemented in 21 | # here, thereby making your hashes incompatible. However, if you must, please 22 | # change the hash type identifier (the "$P$") to something different. 23 | # 24 | # Obviously, since this code is in the public domain, the above are not 25 | # requirements (there can be none), but merely suggestions. 26 | # 27 | class PasswordHash { 28 | var $itoa64; 29 | var $iteration_count_log2; 30 | var $portable_hashes; 31 | var $random_state; 32 | 33 | function PasswordHash($iteration_count_log2, $portable_hashes) 34 | { 35 | $this->itoa64 = './0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; 36 | 37 | if ($iteration_count_log2 < 4 || $iteration_count_log2 > 31) 38 | $iteration_count_log2 = 8; 39 | $this->iteration_count_log2 = $iteration_count_log2; 40 | 41 | $this->portable_hashes = $portable_hashes; 42 | 43 | $this->random_state = microtime(); 44 | if (function_exists('getmypid')) 45 | $this->random_state .= getmypid(); 46 | } 47 | 48 | function get_random_bytes($count) 49 | { 50 | $output = ''; 51 | if (@is_readable('/dev/urandom') && 52 | ($fh = @fopen('/dev/urandom', 'rb'))) { 53 | $output = fread($fh, $count); 54 | fclose($fh); 55 | } 56 | 57 | if (strlen($output) < $count) { 58 | $output = ''; 59 | for ($i = 0; $i < $count; $i += 16) { 60 | $this->random_state = 61 | md5(microtime() . $this->random_state); 62 | $output .= 63 | pack('H*', md5($this->random_state)); 64 | } 65 | $output = substr($output, 0, $count); 66 | } 67 | 68 | return $output; 69 | } 70 | 71 | function encode64($input, $count) 72 | { 73 | $output = ''; 74 | $i = 0; 75 | do { 76 | $value = ord($input[$i++]); 77 | $output .= $this->itoa64[$value & 0x3f]; 78 | if ($i < $count) 79 | $value |= ord($input[$i]) << 8; 80 | $output .= $this->itoa64[($value >> 6) & 0x3f]; 81 | if ($i++ >= $count) 82 | break; 83 | if ($i < $count) 84 | $value |= ord($input[$i]) << 16; 85 | $output .= $this->itoa64[($value >> 12) & 0x3f]; 86 | if ($i++ >= $count) 87 | break; 88 | $output .= $this->itoa64[($value >> 18) & 0x3f]; 89 | } while ($i < $count); 90 | 91 | return $output; 92 | } 93 | 94 | function gensalt_private($input) 95 | { 96 | $output = '$P$'; 97 | $output .= $this->itoa64[min($this->iteration_count_log2 + 98 | ((PHP_VERSION >= '5') ? 5 : 3), 30)]; 99 | $output .= $this->encode64($input, 6); 100 | 101 | return $output; 102 | } 103 | 104 | function crypt_private($password, $setting) 105 | { 106 | $output = '*0'; 107 | if (substr($setting, 0, 2) == $output) 108 | $output = '*1'; 109 | 110 | $id = substr($setting, 0, 3); 111 | # We use "$P$", phpBB3 uses "$H$" for the same thing 112 | if ($id != '$P$' && $id != '$H$') 113 | return $output; 114 | 115 | $count_log2 = strpos($this->itoa64, $setting[3]); 116 | if ($count_log2 < 7 || $count_log2 > 30) 117 | return $output; 118 | 119 | $count = 1 << $count_log2; 120 | 121 | $salt = substr($setting, 4, 8); 122 | if (strlen($salt) != 8) 123 | return $output; 124 | 125 | # We're kind of forced to use MD5 here since it's the only 126 | # cryptographic primitive available in all versions of PHP 127 | # currently in use. To implement our own low-level crypto 128 | # in PHP would result in much worse performance and 129 | # consequently in lower iteration counts and hashes that are 130 | # quicker to crack (by non-PHP code). 131 | if (PHP_VERSION >= '5') { 132 | $hash = md5($salt . $password, TRUE); 133 | do { 134 | $hash = md5($hash . $password, TRUE); 135 | } while (--$count); 136 | } else { 137 | $hash = pack('H*', md5($salt . $password)); 138 | do { 139 | $hash = pack('H*', md5($hash . $password)); 140 | } while (--$count); 141 | } 142 | 143 | $output = substr($setting, 0, 12); 144 | $output .= $this->encode64($hash, 16); 145 | 146 | return $output; 147 | } 148 | 149 | function gensalt_extended($input) 150 | { 151 | $count_log2 = min($this->iteration_count_log2 + 8, 24); 152 | # This should be odd to not reveal weak DES keys, and the 153 | # maximum valid value is (2**24 - 1) which is odd anyway. 154 | $count = (1 << $count_log2) - 1; 155 | 156 | $output = '_'; 157 | $output .= $this->itoa64[$count & 0x3f]; 158 | $output .= $this->itoa64[($count >> 6) & 0x3f]; 159 | $output .= $this->itoa64[($count >> 12) & 0x3f]; 160 | $output .= $this->itoa64[($count >> 18) & 0x3f]; 161 | 162 | $output .= $this->encode64($input, 3); 163 | 164 | return $output; 165 | } 166 | 167 | function gensalt_blowfish($input) 168 | { 169 | # This one needs to use a different order of characters and a 170 | # different encoding scheme from the one in encode64() above. 171 | # We care because the last character in our encoded string will 172 | # only represent 2 bits. While two known implementations of 173 | # bcrypt will happily accept and correct a salt string which 174 | # has the 4 unused bits set to non-zero, we do not want to take 175 | # chances and we also do not want to waste an additional byte 176 | # of entropy. 177 | $itoa64 = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; 178 | 179 | $output = '$2a$'; 180 | $output .= chr(ord('0') + $this->iteration_count_log2 / 10); 181 | $output .= chr(ord('0') + $this->iteration_count_log2 % 10); 182 | $output .= '$'; 183 | 184 | $i = 0; 185 | do { 186 | $c1 = ord($input[$i++]); 187 | $output .= $itoa64[$c1 >> 2]; 188 | $c1 = ($c1 & 0x03) << 4; 189 | if ($i >= 16) { 190 | $output .= $itoa64[$c1]; 191 | break; 192 | } 193 | 194 | $c2 = ord($input[$i++]); 195 | $c1 |= $c2 >> 4; 196 | $output .= $itoa64[$c1]; 197 | $c1 = ($c2 & 0x0f) << 2; 198 | 199 | $c2 = ord($input[$i++]); 200 | $c1 |= $c2 >> 6; 201 | $output .= $itoa64[$c1]; 202 | $output .= $itoa64[$c2 & 0x3f]; 203 | } while (1); 204 | 205 | return $output; 206 | } 207 | 208 | function HashPassword($password) 209 | { 210 | $random = ''; 211 | 212 | if (CRYPT_BLOWFISH == 1 && !$this->portable_hashes) { 213 | $random = $this->get_random_bytes(16); 214 | $hash = 215 | crypt($password, $this->gensalt_blowfish($random)); 216 | if (strlen($hash) == 60) 217 | return $hash; 218 | } 219 | 220 | if (CRYPT_EXT_DES == 1 && !$this->portable_hashes) { 221 | if (strlen($random) < 3) 222 | $random = $this->get_random_bytes(3); 223 | $hash = 224 | crypt($password, $this->gensalt_extended($random)); 225 | if (strlen($hash) == 20) 226 | return $hash; 227 | } 228 | 229 | if (strlen($random) < 6) 230 | $random = $this->get_random_bytes(6); 231 | $hash = 232 | $this->crypt_private($password, 233 | $this->gensalt_private($random)); 234 | if (strlen($hash) == 34) 235 | return $hash; 236 | 237 | # Returning '*' on error is safe here, but would _not_ be safe 238 | # in a crypt(3)-like function used _both_ for generating new 239 | # hashes and for validating passwords against existing hashes. 240 | return '*'; 241 | } 242 | 243 | function CheckPassword($password, $stored_hash) 244 | { 245 | $hash = $this->crypt_private($password, $stored_hash); 246 | if ($hash[0] == '*') 247 | $hash = crypt($password, $stored_hash); 248 | 249 | return $hash == $stored_hash; 250 | } 251 | } 252 | 253 | ?> 254 | -------------------------------------------------------------------------------- /application/views/auth/forgot_password.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | Forgot Password 4 | 5 | 6 | 7 |

Login

8 | 9 | Thank you. We have sent you an email with further instructions on how to reset your password.

'; 12 | } else { 13 | echo form_open(); 14 | echo form_label('Email Address', 'email') .'
'; 15 | echo form_input(array('name' => 'email', 'value' => set_value('email'))) .'
'; 16 | echo form_error('email'); 17 | echo form_submit(array('type' => 'submit', 'value' => 'Reset Password')); 18 | echo form_close(); 19 | } 20 | ?> 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /application/views/auth/login.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | Login 4 | 5 | 6 | 7 |

Sign Up | Forgot Password?

8 | 9 | '. $error .'

'; 11 | echo form_open(); 12 | echo form_label('Email Address', 'email') .'
'; 13 | echo form_input(array('name' => 'email', 'value' => set_value('email'))) .'
'; 14 | echo form_error('email'); 15 | echo form_label('Password', 'password') .'
'; 16 | echo form_password(array('name' => 'password', 'value' => set_value('password'))) .'
'; 17 | echo form_error('password'); 18 | echo form_submit(array('type' => 'submit', 'value' => 'Login')); 19 | echo form_close(); 20 | ?> 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /application/views/auth/reset_password.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | Reset Password 4 | 5 | 6 | 7 |

Login

8 | 9 | You have successfully reset your password.

'; 12 | } else { 13 | echo form_open(); 14 | echo form_label('Password', 'password') .'
'; 15 | echo form_password(array('name' => 'password', 'value' => set_value('password'))) .'
'; 16 | echo form_error('password'); 17 | echo form_label('Confirm Password', 'password_conf') .'
'; 18 | echo form_password(array('name' => 'password_conf', 'value' => set_value('password_conf'))) .'
'; 19 | echo form_error('password_conf'); 20 | echo form_submit(array('type' => 'submit', 'value' => 'Save New Password')); 21 | echo form_close(); 22 | } 23 | ?> 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /application/views/auth/signup.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | Sign Up 4 | 5 | 6 | 7 |

Login

8 | 9 | '. $error .'

'; 11 | echo form_open(); 12 | echo form_label('Email Address', 'email') .'
'; 13 | echo form_input(array('name' => 'email', 'value' => set_value('email'))) .'
'; 14 | echo form_error('email'); 15 | echo form_label('Password', 'password') .'
'; 16 | echo form_password(array('name' => 'password', 'value' => set_value('password'))) .'
'; 17 | echo form_error('password'); 18 | echo form_label('Confirm Password', 'password_conf') .'
'; 19 | echo form_password(array('name' => 'password_conf', 'value' => set_value('password_conf'))) .'
'; 20 | echo form_error('password_conf'); 21 | echo form_submit(array('type' => 'submit', 'value' => 'Sign Up')); 22 | echo form_close(); 23 | ?> 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Gilbert Pellegrom 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software 4 | and associated documentation files (the "Software"), to deal in the Software without restriction, 5 | including without limitation the rights to use, copy, modify, merge, publish, distribute, 6 | sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is 7 | furnished to do so, subject to the following conditions: 8 | 9 | The above copyright notice and this permission notice shall be included in all copies or 10 | substantial portions of the Software. 11 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 13 | BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 14 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 15 | DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --------------------------------------------------------------------------------