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

[eluser]dansmith65[/eluser]
[quote author="cyberjunkie" date="1300494309"]Is there a way to get the username ... to every controller or view I have?[/quote]


You could call this from the __construct() function in all your controllers. It's not quite what you are asking, but easier than doing it in every method of every controller.
Code:
$this->load->vars(array(
    'username' => $this->tank_auth->get_username()
));

You can read about that function in the user guide: http://ellislab.com/codeigniter/user-gui...oader.html

[eluser]JonoB[/eluser]
[quote author="dansmith65" date="1300494766"][quote author="cyberjunkie" date="1300494309"]Is there a way to get the username ... to every controller or view I have?[/quote]


You could call this from the __construct() function in all your controllers. It's not quite what you are asking, but easier than doing it in every method of every controller.
Code:
$this->load->vars(array(
    'username' => $this->tank_auth->get_username()
));

You can read about that function in the user guide: http://ellislab.com/codeigniter/user-gui...oader.html[/quote]
Tankauth automatically stores the username in the session. Any reason why that is not good enough?

In addition, if you propose putting a method into every controller constructor, then its much better to create MY_Controller extends CI_Controller and just put the method there once...its then available to all your controllers automatically.

[eluser]dansmith65[/eluser]
Thanks for adding that JonoB.

I just did a test from a view file, and I was able to get username via either of these...

Code:
<?php echo $this->session->userdata('username'); ?>
<?php echo $this->tank_auth->get_username(); ?>

[eluser]cyberjunkie[/eluser]
Thanks for the replies!

JonoB, I assumed that it's stored in the session but for some reason it does not retrieve it. For instance I display the username in the header that's on every page. If a controller doesn't have the variable I get Undefined variable: username in the header view.

Why so I get that if the username is in the session? That's what I don't get..

Should I use echo $this->tank_auth->get_username()?

[eluser]Unknown[/eluser]
where do i get the "Security" Library ??

i get an error saying that i need to load it but i do not see it in the library folder under application

[quote author="SaintNicster" date="1288741036"][quote author="mdvaldosta" date="1287608505"]To get it working with 2.0 I've renamed the 3 models for tank_auth to extend CI_Model instead of Model, and changed $this->load->plugin('captcha') to $this->load->helper('captcha') on line 499 of the auth.php controller. Also, on line 45 of auth.php change $login = $this->input->xss_clean($login) to $login = $this->security->xss_clean($login)

*edit - actually changing the login to use security instead of input still didn't work, I get an error about calling a non-object. So I just commented out the code until someone else can chime in.[/quote]

Security is a library. You have to add
Code:
$this->load->library('security');
before the call to
Code:
$this->security->xss_clean($login)
[/quote]

[eluser]imcl[/eluser]
Has anyone been able to integrate OpenID into tank_auth? I just found a CI wiki on OpenID implementation, but not sure how that would play along with tank_auth.

http://codeigniter.com/wiki/OpenID/

I also wonder if using OpenID will require some kind of connection with my database.

Any comments on this are welcome! Thanks.

[eluser]Bangon Kali[/eluser]
Thank you for this library! Big Grin

[eluser]Unknown[/eluser]
In case somebody else is having the same problem I had:

It seems the recaptcha helper that is in the tank_auth package points to the old URLs (at recaptcha.net), and a URL change announced by google some time ago has recently been put into effect; this broke recaptcha on my site using tank_auth. Anyway, the fix was simple; I found an updated helper file here

http://code.google.com/p/recaptcha/sourc....php?r=129

Replacing the recaptcha_helper.php file in the package with this file does the trick. I'll email the developer as well to suggest a fix to the package.

[eluser]Unknown[/eluser]
Hi!I have been playing around with this library, which is absolutely awesome. I was testing it and I think there's a problem when a non activated User tries to log in. I was just wondering if any of you noticed this already? What happens is that the User is redirected to the send_again page, but once there, we are not able to change the url to any other location anymore. I am guessing that this happens because of the session info that is not destroyed - in the login function :

elseif ($this->tank_auth->is_logged_in(FALSE)) {
// logged in, not activated
redirect('/auth/send_again/');
this gets executed all the time (unless we force a logout). Does anybody knows how to fix this? Thanks!

[eluser]Bangon Kali[/eluser]
What to do you wish to happen then if the user is not yet activated and wants to login? Do you want him to login? Or do you want him to be sent to a custom page? You can edit the redirect or you can edit the send_again view. It's really up to you. But if you want non-activated users to login, I think there's a rule in the config file, or you can edit the line where it says $this->tank_auth->is_logged_in(FALSE) to TRUE.




Theme © iAndrew 2016 - Forum software by © MyBB