CodeIgniter Forums
Ion Auth - Lightweight Auth System based on Redux Auth 2 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Ion Auth - Lightweight Auth System based on Redux Auth 2 (/showthread.php?tid=27435)



Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 11-16-2010

[eluser]33cent[/eluser]
The easiest way will be setting up new passwords for users, imho.


Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 11-16-2010

[eluser]Frank Rocco[/eluser]
I know, but they would complain. I was hoping to somehow reverse the encrypt.
I guess it is only one way.


Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 11-17-2010

[eluser]Danjurou[/eluser]
How to set login by username?


Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 11-17-2010

[eluser]Davide Bellini[/eluser]
In "config" folder, edit "ion_auth.php" and change :

/**
* A database column which is used to
* login with.
**/
$config['identity'] = 'email'; <---------------


Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 11-17-2010

[eluser]joytopia[/eluser]
Upgraded to CI 2.0

Now, with "remember me" after the session is expired, I get the error:

Code:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Member::$ion_auth
Filename: core/Model.php
Line Number: 50

When I commend this paragraph in the constructor, the error is gone:

Code:
/*
//auto-login the user if they are remembered
if (!$this->logged_in() && get_cookie('identity') && get_cookie('remember_code'))
{
   $this->ci->ion_auth_model->login_remembered_user();
}
*/

But of course the user is not remembered any more.

Seems, that CI 2.0 has problems when functions of other classes are called in a constructor.
Any idea how to fix it?

Best regards

Bernd


Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 11-17-2010

[eluser]Ben Edmunds[/eluser]
Hey Bernd,

I'm not sure what's up with that error.

We're using Ion Auth with CI 2 in Pyro with no issues...


Let me know if I can help or if you figure out what's up. Are you using CI 2 from tip?


Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 11-18-2010

[eluser]joytopia[/eluser]
Ben,

For the latest CI2 I took the download link from Phil's blog:
http://philsturgeon.co.uk/news/2010/05/upgrading-to-codeigniter-2.0
That link takes me to the original download from BitBucket:
http://bitbucket.org/ellislab/codeigniter/get/tip.zip

The error came everywhere in my scripts when I called functions of other models or libraries in a constructor. Since with CI 1.72 everything was OK, I thought, that is a problem of CI2, and I changed all constructors in my scripts. Only ION AUTH's constructor remains and brings that error.

No idea how to fix it.

Best regards
Bernd


Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 11-18-2010

[eluser]Thinkers[/eluser]
I have the same error of joytopia.
Anyone has managed to resolve the issue?

I am using CI2 and Ion_auth too.

For now, simply changing the controller construct from

Code:
function __construct()
    {
        parent::__construct();
        $this->load->library('ion_auth');
        /*-----------------------------------------*/
        $this->ion_auth->set_error_delimiters('','');
        /*-----------------------------------------*/
        $this->load->model("users_model");
        $this->load->model('messages_model');
        $this->load->helper('url');
        $this->load->helper('breadcrumb_admin');
        $this->load->helper('slug');
        $this->output->enable_profiler($this->config->item('debug_enabled'));
    }

to

Code:
function __construct()
    {
        parent::__construct();
        $this->load->library('ion_auth');
        $this->load->model("users_model");
        $this->load->model('messages_model');
        $this->load->helper('url');
        $this->load->helper('breadcrumb_admin');
        $this->load->helper('slug');
        /*-----------------------------------------*/
        $this->ion_auth->set_error_delimiters('','');
        /*-----------------------------------------*/
        $this->output->enable_profiler($this->config->item('debug_enabled'));
    }

seems to kick the error away.

EDIT: The issue is still present, so it is not related to the calling order in the controller.

Would you please check this? I have found no solutions yet.

Thank you.


Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 11-18-2010

[eluser]Andy78[/eluser]
I'm using the widget plugin from wiredesignz along with ion_auth to create a login widget that displays in a side bar on every page and so far this is working fine apart from an issue with form validation that I cant seem to solve. its to do with this segment of code in the login widget:

Code:
class User_login extends Widget
{
    function run($visible = True) {
                
        //check to see if the user is logging in
        if ($this->form_validation->run('login') == true)
        {            
            if ($this->input->post('remember') == 1) {//check for "remember me"
                $remember = true;
            }
            else {
                $remember = false;
            }
            
            if ($this->ion_auth->login($this->input->post('username'), $this->input->post('password'), $remember))
            {   //if the login is successful redirect them back to the home page
            
                $this->session->set_flashdata('message', $this->ion_auth->messages());
                redirect($this->config->item('base_url'), 'refresh');
            }
            else
            {    //if the login was un-successful redirect them back to the login page
                
                $data['message'] = 'Incorrect username or password. Please try again.';
              
              //  $data['message'] = '';
                   $data['username']   = array('name'   => 'username',
                                              'id'      => 'username',
                                              'type'    => 'text',
                                             );
                                            
                $data['password']   = array('name'    => 'password',
                                              'id'      => 'password',
                                              'type'    => 'password',
                                            );
                                            
            }
        }

What is happening is if I display a form with form validation on another page of my site and the login widget is also displayed in the side bar, when the form is submitted the message 'Incorrect username or password. Please try again.' is always displayed in the login widget even though the login form within the widget is not what was submitted.

The problem is obviously to do with $this->form_validation->run being in the form and the widget but I thought adding the validation rules into groups would solve this but its not.

Any ideas?


Ion Auth - Lightweight Auth System based on Redux Auth 2 - El Forum - 11-18-2010

[eluser]Ben Edmunds[/eluser]
Andy78,

Please post the solution that we worked out on IRC for the benefit of future readers. Thanks!