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

[eluser]brainer[/eluser]
Okay, cool. Thanks.

I also have another little problem now, which i also had with DX Auth.

i cant seem to set 'remember me' to not remember the user, no matter what i do. I've even tried to hardcode it out in the controller like so...

Code:
if ($this->tank_auth->login(
                        $this->form_validation->set_value('login'),
                        $this->form_validation->set_value('password'),
                        FALSE,
                        $data['login_by_username'],
                        $data['login_by_email']))

... it still remembers me. do you have any idea what this is?

EDIT:
I should also add that im doing my login through ajax.

[eluser]Gromozeka[/eluser]
You changed the code right. Please remove cookie again and your changes will take effect. Smile

Also I recommend you comment the line
Code:
$this->autologin();
in library constructor to disable autologin (since it's not used on your site).

PS: Sorry, I'm not too experienced AJAX-programmer. Sad

[eluser]jshultz[/eluser]
Ok, I've plugged away at my original problem and got that all sorted. my next problem is that I'm trying to do an if/then/else setup in the side bar so that it shows a "welcome $username ..." if you're logged in or a login form if you're not logged in. any suggestions?

Edited to clarify:

I have the sidebar currently like this:

Code:
<?php if (!$this->tank_auth->is_logged_in()): ?>
    
        <p>You're not logged in. Please&lt;?php echo anchor('/auth/login', 'login'); ?&gt;</p>
    
    &lt;?php else: ?&gt;
    
        <p>Hi, <strong>&lt;?php echo $username; ?&gt;</strong>! You are logged in now. &lt;?php echo anchor('/auth/logout/', 'Logout'); ?&gt;</p>
    
    &lt;?php endif; ?&gt;

Which is a good start, but i would really like it to show the login form instead.

[eluser]brainer[/eluser]
Thanks Gromozeka, but still no luck. This is driving me crazy. :-S

Actually, i want to allow users to autologin, but the problem is - no matter what they choose, they always get remembered. And even if i try to force a 'dont rememeber', it still gets remembered! :ahhh:

In an attempt to force a don't remember, i've tried this, deleting cookies before every login attempt.

and even if i comment out
Code:
$this->autologin();

and hard-code 'FALSE' like so...
Code:
($this->tank_auth->login(
                        $this->form_validation->set_value('login'),
                        $this->form_validation->set_value('password'),
                        FALSE,
                        $data['login_by_username'],
                        $data['login_by_email']))

but still no joy. it seems really weird.

[eluser]Gromozeka[/eluser]
linasaur, I guess I know what's the problem. The sessions don't expire.

I've just reconstructed it on my site. I stay logged in on the site even after I close the browser and open it again. My session doesn't expire: CI considers the previous session as still active and continues to use it. That's why I still logged in.

More info about that here:
http://ellislab.com/forums/viewthread/93945/
http://ellislab.com/forums/viewthread/109645/

PS: No doubt it's very annoying. I'm looking for the solution now, but if you find it first, please write here about it.

[eluser]brainer[/eluser]
Got a solution by drewbee, found it here:
http://ellislab.com/forums/viewthread/109645/#553043

it is a weird issue though, i wonder why codeigniter forces that.

thanks for all the help Gromozeka.

EDIT: Actually... now it just wont remember, ill continue looking for a solution.

[eluser]NateL[/eluser]
Any chance of Roles being a part of this library? I like it - but need roles Sad

[eluser]geocine[/eluser]
[HELP]

I am currently using tank_auth for my admin module, the default controller of my admin module is the admin page of course. How would I set my default controller to the login page and when the user is logged in, it would redirect to the admin page.

anything that maps to admin/** should redirect to login page if user is not logged in. But, will continue to the specific page (eg. admin/user/view) if user is logged in.

[eluser]Gromozeka[/eluser]
[quote author="NateL" date="1249432760"]Any chance of Roles being a part of this library? I like it - but need roles Sad[/quote]

Sorry, no. I'd like to leave Tank Auth light-weighted, as it is.

(But Role management can be implemented as a separate add-on library.)

[eluser]Gromozeka[/eluser]
[quote author="geocine" date="1249887362"][HELP]

I am currently using tank_auth for my admin module, the default controller of my admin module is the admin page of course. How would I set my default controller to the login page and when the user is logged in, it would redirect to the admin page.

anything that maps to admin/** should redirect to login page if user is not logged in. But, will continue to the specific page (eg. admin/user/view) if user is logged in.[/quote]

Please check welcome.php controller from the zip. It does exactly what you want -- redirects non-authorized user to login, otherwise prints welcome message.




Theme © iAndrew 2016 - Forum software by © MyBB