Simple authentication and authorization library for codeigniter
How to setup ?
-
Copy the myauth folder in the third party folder of your application.
-
Autoload the package and library in autoload.php
$autoload['packages'] = array(APPPATH.'third_party/myauth');
$autoload['libraries'] = array('myauth' , 'form_validation' , 'session');
$autoload['helper'] = array('url' , 'form'); -
Copy the Auth.php controller from myauth controllers folder and copy it to your application controllers folder.
-
Import the myauth.sql to your mysql database.
Note - For using the reset pasword functionality, please make sure you have correctly configured the email settings.
You can do so by adding email.php in application/config folder.
1. Simply go to "your project / auth / login" for login page.
2. Simply go to "your project / auth / register" for register page.
check()
Syntax - $this->myauth->check()
Use - checks whether the user is logged in or not.
Return - Function returns true if user is logged in else false.
Parameters - If you are using parameters in check() function then use role names as parameters.
Example - $this->myauth->check('admin')
This will check that user is logged in as well as it is a admin.