Welcome Guest, Not a member yet? Register   Sign In
Tank Auth v1.0 (CI authentication library)

[eluser]laurisnet[/eluser]
Sorry man, No Idea how to do it.

But I get solution to my answer.
So its like that:

Put this in controller which is loaded when you want to show captcha
$this->load->library('tank_auth');
// Captcha
$use_recaptcha = $this->config->item('use_recaptcha', 'tank_auth');
if ($use_recaptcha) {
$data['recaptcha_html'] = $this->_create_recaptcha();
} else {
$data['captcha_html'] = $this->_create_captcha();
}
$data['use_recaptcha'] = $use_recaptcha;


And this where you want to check if its true:

if($cap == $this->session->flashdata('captcha_word')){
$captcha_valid = true;
$user_type = 'guest';
}

[eluser]Unknown[/eluser]
I'm loving this library. Just wondered if anyone can point me in the right direction. I want a login form on every page if not logged in. if they are logged in displays the user menu. what would be the best way of implementing this?

[eluser]cheng[/eluser]
It doesn't clear the login attemps after login as it should be.
Does anyone know how to fix this?

EDIT: Sorry, solved myself. :red:

[eluser]Craig300[/eluser]
Hi michael1224,

I have used this library for a custom CMS and found that one way to solve your problem is to insert a check into the top of the controller that checks the user's current login status and if the user is not logged in, redirect them to your login form.

Craig

[eluser]rip_pit[/eluser]
Hi, i write a little optimisation in the auth controller. I don't know if this is usefull or if CI already does the check automaticaly.

It would be cool if someone can give the answer !

here my new code :
Code:
class Auth extends Controller
{
    function __construct()
    {
        parent::__construct();

        //
        // CODE ORIGINAL TANK AUTH
        //
        //$this->load->helper(array('form', 'url'));
        //$this->load->library('form_validation');
        //$this->load->library('tank_auth');
        //$this->lang->load('tank_auth');

        //
        // OPTIMISED LOADING
        //
        //optimise the modules loading, checking if they are already loaded
        //by autoload for example
        $this->CI =& get_instance();
        //only load if needed
        if ( ! array_key_exists( "url_helper", $this->CI->load->_ci_helpers ) )
        {
            $this->load->helper('url');
        }

        if ( ! array_key_exists( "form_helper", $this->CI->load->_ci_helpers ) )
        {
            $this->load->helper('form');
        }

        if ( ! in_array('form_validation', $this->CI->load->_ci_classes))
        {
            $this->load->library('form_validation');
        }

        if ( ! in_array('tank_auth', $this->CI->load->_ci_classes))
        {
            $this->load->library('Tank_auth');
        }

        if ( ! in_array('tank_auth_lang'.EXT, $this->CI->lang->is_loaded, TRUE))
        {
            $this->CI->lang->load('tank_auth');
        }

    }//func
//...
}//class

[eluser]tobefound[/eluser]
@Gromozeka:

I was wondering why you create a new cookie for the autologin feature? Why not use the CI session cookie for this? Are there security issues having that info in the same cookie? Just curious. Smile

/T

[eluser]bogdan3l[/eluser]
Hello!

I have a question, why the last_ip is varchar(40) and not int or varchar(15)?

Thank you!

[eluser]Devon Lambert[/eluser]
@rip_pit: I believe CI already does this check for us. Hence any model, library, or helper that has already been loaded earlier in the chain will not be re-loaded.

[eluser]Calavera[/eluser]
Hello. Great library. Any thoughts on why I keep getting "Your activation key is incorrect or expired." when try to reset my pass from the mail sent by "forgot pass" ? The userid and pass key are identified ok, and it matches the db entry also.

Thanks in advance.

[eluser]rip_pit[/eluser]
[quote author="Devon Lambert" date="1265242811"]@rip_pit: Hence any model, library, or helper that has already been loaded earlier in the chain will not be re-loaded.[/quote]

it's what i wanted to be confirmed Smile I'm convinced that CI does the check
Thanks for your reply Wink


@calavera: Sorry, it's working perfectly here!

Your activation url must contains the user's id + hash key (.../auth/reset_password/userid/hashkey)

Compare these values with the ones in the db :
hash key should match > db > users > new_password_key
user's id should match > db > users > id




Theme © iAndrew 2016 - Forum software by © MyBB