Skip to content

Simple and lightweight authentication and authorization library for CodeIgniter 3.x

Notifications You must be signed in to change notification settings

asaif332/myauth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

myauth

Simple authentication and authorization library for codeigniter

How to setup ?

  1. Copy the myauth folder in the third party folder of your application.

  2. 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');

  3. Copy the Auth.php controller from myauth controllers folder and copy it to your application controllers folder.

  4. 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.



How to use ?

1. Simply go to "your project / auth / login" for login page.
2. Simply go to "your project / auth / register" for register page.


Authorization functions

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.