Welcome Guest, Not a member yet? Register   Sign In
DX Auth 1.0.6 (Authentication library)

[eluser]the_namdeeW[/eluser]
I installed DX Auth, and everything seems to work fine, except for showing the Captcha image at the login screen. Help anyone?

[eluser]CARP[/eluser]
Hi guys
I'm attaching the spanish language.
Hope it is useful for someone

[eluser]Wooo[/eluser]
[quote author="Skootz 25" date="1239749255"]I installed DX Auth, and everything seems to work fine, except for showing the Captcha image at the login screen. Help anyone?[/quote]

See my previous post:
[quote author="Wooo" date="1237516324"]I had the same issue. The problem was solved by removing the dot from the captcha’s file name. To do this, I altered system/plugins/captcha_pi.php. At line 246, I changed

$now = ((float)$usec + (float)$sec);

into

$now = ((int)$usec + (int)$sec); [/quote]

Or: use recaptcha

[eluser]HomersBrain[/eluser]
[quote author="Skootz 25" date="1239749255"]I installed DX Auth, and everything seems to work fine, except for showing the Captcha image at the login screen. Help anyone?[/quote]

Have you set the captcha folders permissions as per the installation instructions?

[eluser]Xeoncross[/eluser]
It would be nice if DX Auth supported URI redirects so that if we call deny_access() then after they login we can (optionally) send them back to the page they were trying to access.

First we need to be able to encode the return_to url
Code:
//Alows me to pass complex values though the URL
function base64_url_encode($string=null){
  return strtr(base64_encode($string), '+/=', '-_~');
}

//Alows me to recive complex values though the URL
function base64_url_decode($string=null) {
  return base64_decode(strtr($string, '-_~','+/='));
}

Then we need to allow the deny_access() function to have a new "return_to" param.
Code:
function deny_access($uri = 'deny', $return_to=null)
    {
        $this->ci->load->helper('url');
    
        if ($uri == 'login')
        {
            if($return_to) {
                $return_to = base64_url_encode($return_to);
            }
            redirect($this->ci->config->item('DX_login_uri'). $return_to, 'location');
        }
        else if ($uri == 'banned')
        {
            redirect($this->ci->config->item('DX_banned_uri'), 'location');
        }
        else
        {
            redirect($this->ci->config->item('DX_deny_uri'), 'location');            
        }
        exit;
    }

Now the only other thing to edit is the Auth controller on login() and logout() functions so that they can deal with the redirect to send the user back to wherever they were.

Code:
function login($return_to = NULL)
    {
        if ( ! $this->dx_auth->is_logged_in())
        {
            $val = $this->form_validation;
            
            // Set form validation rules
            $val->set_rules('username', 'Username', 'trim|required|xss_clean');
            $val->set_rules('password', 'Password', 'trim|required|xss_clean');
            $val->set_rules('remember', 'Remember me', 'integer');

            // Set captcha rules if login attempts exceed max attempts in config
            if ($this->dx_auth->is_max_login_attempts_exceeded())
            {
                $val->set_rules('captcha', 'Confirmation Code', 'trim|required|xss_clean|callback_captcha_check');
            }
                
            if ($val->run() AND $this->dx_auth->login($val->set_value('username'), $val->set_value('password'), $val->set_value('remember')))
            {
                //-------------------Added for redirect ---------------------//
                //If they were trying to access another page - then send them back now!
                if($return_to) {
                    $return_to = base64_url_decode($return_to);
                }
                //-------------------Added for redirect ---------------------//
            
                // Redirect (default to homepage)
                redirect($return_to, 'location');
            }
            else
            {
                // Check if the user is failed logged in because user is banned user or not
                if ($this->dx_auth->is_banned())
                {
                    // Redirect to banned uri
                    $this->dx_auth->deny_access('banned');
                }
                else
                {                        
                    // Default is we don't show captcha until max login attempts eceeded
                    $data['show_captcha'] = FALSE;
                
                    // Show captcha if login attempts exceed max attempts in config
                    if ($this->dx_auth->is_max_login_attempts_exceeded())
                    {
                        // Create catpcha                        
                        $this->dx_auth->captcha();
                        
                        // Set view data to show captcha on view file
                        $data['show_captcha'] = TRUE;
                    }
                    
                    // Load login page view
                    $this->load->view($this->dx_auth->login_view, $data);
                }
            }
        }
        else
        {
            //-------------------Added for redirect ---------------------//
            //If they were trying to access another page - then send them back now!
            if($return_to) {
                redirect(base64_url_decode($return_to));
            }
            //-------------------Added for redirect ---------------------//
            
            $data['auth_message'] = 'You are already logged in.';
            $this->load->view($this->dx_auth->logged_in_view, $data);
        }
    }
    
    function logout($return_to = NULL)
    {
        $this->dx_auth->logout();
        
        //-------------------Added for redirect ---------------------//
        //If they were trying to access another page - then send them back now!
        if($return_to) {
            redirect(base64_url_decode($return_to));
        }
        //-------------------Added for redirect ---------------------//
        
        $data['auth_message'] = 'You have been logged out.';        
        $this->load->view($this->dx_auth->logout_view, $data);
    }

Being able to send people back to a page after they login saves the user from having to go re-find that page each time they login. Definitely something that should be included in this awesome system.

Now with just a couple small lines added to DX Auth we can return users to wherever they where before they tried to login.
Code:
//Must be logged in!
if ( ! $this->dx_auth->is_logged_in()) {
    // Redirect to login page (return to the upload/index page)
    $this->dx_auth->deny_access('login', 'upload/index/');
}

[eluser]CARP[/eluser]
Xeoncross
That addition/mod you did is a must. Contact dx_auth's author. I think he'll agree to include this mod in the library

[eluser]Dartmien[/eluser]
[quote author="vxav" date="1237580443"][quote author="vxav" date="1237575217"]hi every one, I've got a problem with DX_Auth and captcha : I always have a captcha expired error.

Any idea ?

Thanks for your help ![/quote]

That's Ok, it was due to a <link> tag pointing to a bad stylesheet in my header![/quote]

Have the same problem here, was that a link tag from the plugin or something from your application?

Thanks in advance

---------------------------------------------------------------------
Edit (04/21)

Ok, found out that captcha flashdata changes when code gets to the captcha validation function. My database shows 8 or 9 records in ci_sessions after an atempt to register a user, one of those has captcha data (word generated and time that should be verified to expire) but it just doesnt work when I try to register or log in. Any clue??

[eluser]Fielder[/eluser]
What is the default admin password? I ran the lengthy SQL statement and the password now stored in the dbase is encrypted.

[eluser]Diego.xeis[/eluser]
I think is HELLO the admin password

[eluser]humugus[/eluser]
yes it is hello, but lowercase !




Theme © iAndrew 2016 - Forum software by © MyBB