Welcome Guest, Not a member yet? Register   Sign In
A tutorial about Ion Auth and authentication in CI3
#1

(This post was last modified: 10-28-2015, 06:23 AM by Avenirer.)

Maybe you will find out that I speak too much about Ion Auth, given my previous tutorial series regarding the creation of a multilanguage site (http://avenir.ro/create-cms-using-codeigniter-3/)...

And yet, I keep seeing people having trouble understanding how Ion Auth works. So I will start a new tutorial series about using Ion Auth for creating an authentication system. Hope you enjoy it.

http://avenir.ro/authentication-system-w...h-and-ci3/
Reply
#2

thanks -- will share this tutorial with others asking about auth for codeigniter.
Reply
#3

The second part of my new tutorial series about Ion Auth in CI3 - this one is about registering users.

http://avenir.ro/authentication-system-w...igniter-3/
Reply
#4

@Avenirer
I hope you will use IonAuth 2.0
https://github.com/benedmunds/CodeIgniter-Ion-Auth

Also can you make a tutorial on how to use Ionauth 2.0 in wiredesignz HMVC.
Reply
#5

@solidcodes Why would I use an older version of Ion Auth Smile

Also... I am not an user of HMVC. Smile
Reply
#6

@Avenirer
that's sad it's really easy to organize MVC in HMVC.
Reply
#7

(This post was last modified: 10-29-2015, 08:27 PM by orionstar.)

(10-29-2015, 04:14 PM)solidcodes Wrote: @Avenirer
that's sad it's really easy to organize MVC in HMVC.

It's very easy to use Ion Auth with HMVC. You create a module e.g. "users", you put Ion Auth into that folder. When you want to load Ion auth you load the library from the module: $this->load->library('users/ion_auth'); Then you replace the redirects in Ion Auth controller with a starting 'users/' (for example: redirect('users/login')), then rewrite every load in the Ion_auth.php libary file and in the model... also you should replace the form_open occurancies to start with 'users/'. Then you're done!
Reply
#8

(10-29-2015, 08:27 PM)orionstar Wrote:
(10-29-2015, 04:14 PM)solidcodes Wrote: @Avenirer
that's sad it's really easy to organize MVC in HMVC.

It's very easy to use Ion Auth with HMVC. You create a module e.g. "users", you put Ion Auth into that folder. When you want to load Ion auth you load the library from the module: $this->load->library('users/ion_auth'); Then you replace the redirects in Ion Auth controller with a starting 'users/' (for example: redirect('users/login')), then rewrite every load in the Ion_auth.php libary file and in the model... also you should replace the form_open occurancies to start with 'users/'. Then you're done!

Your authentication should not be part of a module. Modules are, or should be, independent pieces of structured code. Making it part of a module means any other module, controller, library or model where authentication is required would be depended on the User module.
Keep it as a regular CI library. If you know how to work with Ion Auth the difference between using it in a regular controller or a MX_controller is minimal.
Reply
#9

@orionstar

thanks for the advice.
Reply
#10

(This post was last modified: 10-30-2015, 08:20 AM by orionstar.)

(10-30-2015, 02:07 AM)Martin7483 Wrote:
(10-29-2015, 08:27 PM)orionstar Wrote:
(10-29-2015, 04:14 PM)solidcodes Wrote: @Avenirer
that's sad it's really easy to organize MVC in HMVC.

It's very easy to use Ion Auth with HMVC. You create a module e.g. "users", you put Ion Auth into that folder. When you want to load Ion auth you load the library from the module: $this->load->library('users/ion_auth'); Then you replace the redirects in Ion Auth controller with a starting 'users/' (for example: redirect('users/login')), then rewrite every load in the Ion_auth.php libary file and in the model... also you should replace the form_open occurancies to start with 'users/'. Then you're done!

Your authentication should not be part of a module. Modules are, or should be, independent pieces of structured code. Making it part of a module means any other module, controller, library or model where authentication is required would be depended on the User module.
Keep it as a regular CI library. If you know how to work with Ion Auth the difference between using it in a regular controller or a MX_controller is minimal.

You don't have to use MX_Controller if you only want to use modular separation, MX_Controller is only required when you want to use the HMVC design pattern.

You say it correctly "SHOULD BE" but in some use cases it's more simple and practical to create dependencies.

For example if you have a module updater function in your CMS and you want to update the users module to the latest version and it's require to use the latest Ion Auth library, then you can't simple update only the module folder by replacing it, instead you have to replace libraries and other stuff in the core application. This makes the updater more complex and hard to maintain.

Other examples as usual dependencies: settings, groups, permission, comments, files etc...
Almost every complex module have dependencies... if you have a permission module then the dependencies of it can be the groups and the users module...

If I would like to work in a strict environment which restrict me then I would choose Symfony 2 or Zend 2 and follow their best practises and PSR stuffs... I use CI because I can do everything the way I think it's appropriate and practical.

Ps. In CI + HMVC based CMSs the best practise is using dependent modules... And also in L4 + creolab/laravel-modules...

@avenirer: Sorry for the off topic :S
Reply




Theme © iAndrew 2016 - Forum software by © MyBB