• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help protecting controller with authentication

#1
[eluser]paulo_cv[/eluser]
Hello,

I have a very basic application for learning purposes that basically views, adds, edits and deleted rows from a db.

Everything works fine but now I am trying to set it up so that when the user tries to edit or delete a record they are requested to authenticate (admin functions if you will).

I searched through authentication systems and unfortunately all I found had a lot more of what I needed. I tried using https://github.com/mikedfunk/CI-Authentication for the simple fact that it lets you protect specific functions in a controller by just adding
Code:
$this->ci_authentication->restrict_access();
then it will do the work of checking if there is a session established, redirect to login page otherwise, etc.

The problem is that this library already has a "successful url" parameter and it redirects to this page once the session has been established but what I would like instead is to redirect to the page the user was requesting when they were asked to login.

I tried modifying this library to fit my needs but I am afraid I am no expert and I just couldn't get it done.

I thought it might be easier to just control my simple needs through my own model and controllers but I wanted to check if someone has run into a library or helper that does what I am trying to do without so many bows and whistles as a full authentication system.

Thanks very much in advance.




#2
[eluser]paulo_cv[/eluser]
In case somebody is in need of this I have finally accomplished it using Ion Auth: https://github.com/EllisLab/CodeIgniter/...uth-System

Very simple to setup and very clean code.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.