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

[eluser]pdriggett[/eluser]
Ok, I have just uploaded Tank Auth into what I think are the correct locations and made sure to set up my configs correctly. I see the login page and go to the register page, but no CAPTCHA is showing up at all.

You can see this at www.versustd.com

I have the captcha folder that came with the tank auth .zip and I put it in the root directory at the same level as application. I also tried placing it in the codeigniter folder since his instructions say: "Copy the captcha folder to your CI folder. Make sure this folder is writable by web server."

I have also made sure to make it writable.

Any suggestions?

[eluser]pabloheim[/eluser]
[quote author="pdriggett" date="1283212063"]Ok, I have just uploaded Tank Auth into what I think are the correct locations and made sure to set up my configs correctly. I see the login page and go to the register page, but no CAPTCHA is showing up at all.

You can see this at www.versustd.com

I have the captcha folder that came with the tank auth .zip and I put it in the root directory at the same level as application. I also tried placing it in the codeigniter folder since his instructions say: "Copy the captcha folder to your CI folder. Make sure this folder is writable by web server."

I have also made sure to make it writable.

Any suggestions?[/quote]

did you change the

Code:
$config['captcha_registration'] = FALSE;

in the tank auth config file?

[eluser]pdriggett[/eluser]
Code:
$config['allow_registration'] = TRUE;
$config['captcha_registration'] = TRUE;
$config['email_activation'] = TRUE;
$config['email_activation_expire'] = 60*60*24*2;
$config['email_account_details'] = TRUE;
$config['use_username'] = TRUE;

$config['username_min_length'] = 4;
$config['username_max_length'] = 20;
$config['password_min_length'] = 4;
$config['password_max_length'] = 20;

This is what my config looks like.

[eluser]pabloheim[/eluser]
[quote author="pdriggett" date="/p1283224980"]
Code:
$config['allow_registration'] = TRUE;
$config['captcha_registration'] = TRUE;
$config['email_activation'] = TRUE;
$config['email_activation_expire'] = 60*60*24*2;
$config['email_account_details'] = TRUE;
$config['use_username'] = TRUE;

$config['username_min_length'] = 4;
$config['username_max_length'] = 20;
$config['password_min_length'] = 4;
$config['password_max_length'] = 20;

This is what my config looks like.[/quote]

hey look :

i enter many times wrong user/pass until i make captcha appear . and look

http://img820.imageshack.us/img820/8789/41476694.jpg


do you have gd support?

[eluser]pdriggett[/eluser]
It looks like it: http://www.versustd.com/gd-test.php

[eluser]pdriggett[/eluser]
Well, I couldn't find the problem, but I did convert to using reCaptcha instead and it is working perfectly.

Perhaps I'll try it again in the future, but for now I'm fine, since it works.

[eluser]mitring[/eluser]
Hi Smile

I have two problems with send email:

1) email in Outlook 2007 have wronk link
Code:
http://localhost/katalog_firm/auth/activate/21/9a8ec72ca30=df14aeb112ae518f52de
mail on Thunderbird is OK
Code:
http://localhost/katalog_firm/auth/activate/22/65b25fee2fc6807f386d2e02c1a6fbfa

http://a.imageshack.us/img714/6852/outlookp.jpg
http://a.imageshack.us/img809/1354/thunderbird.jpg

2) how to send mail in text/plain? My config:
Code:
$config['mailtype'] = 'text';
mail is text/plain but content is in html

Reg
Peter Smile

[eluser]stuckinphp[/eluser]
[quote author="pdriggett" date="1283304490"]Well, I couldn't find the problem, but I did convert to using reCaptcha instead and it is working perfectly.

Perhaps I'll try it again in the future, but for now I'm fine, since it works.[/quote]

Pretty sure that homebrew captcha is there in tank auth only to pick up long tail users that have strict server settings in place. You should always use reCaptcha given the chance, its great, secure (most unhackable one out there), free!

Never roll your own captcha you'll just get owned by v14gr4 spam.

[eluser]Unknown[/eluser]
First post...yay

I'm a pretty terrible (new) web developer, I have been getting my head round codeigniter over the last couple of weeks and learning OOP. I have started a project on CI and needed an auth library and various blog posts led me to Tank Auth.

My project needs user roles, and also the user name to be stored with initial login. So against all the principles I have read in the thread I have modified the users table and library to allow me to display info based on the users role.

The changes I made are as follows.

Added 'role' and 'full_name' to the Users table

In the Tank_auth.php file (library) on lines 76/77 (login method) I added
Code:
'role'=> $user->role,
'full_name' => $user->full_name,

I also added a couple of methods in the same vein as the get_user_id() functions:
Code:
function get_user_role()
    {
        return $this->ci->session->userdata('role');
    }
    
    function get_user_fullname()
    {
        return $this->ci->session->userdata('full_name');
    }

Edited create user method to include the addition of a 'your name' field in the register view
Code:
function create_user($username, $email, $password, $email_activation, $your_name)
    {
        if ((strlen($username) > 0) AND !$this->ci->users->is_username_available($username)) {
            $this->error = array('username' => 'auth_username_in_use');

        } elseif (!$this->ci->users->is_email_available($email)) {
            $this->error = array('email' => 'auth_email_in_use');

        } else {
            // Hash password using phpass
            $hasher = new PasswordHash(PHPASS_HASH_STRENGTH, PHPASS_HASH_PORTABLE);
            $hashed_password = $hasher->HashPassword($password);

            $data = array(
                'username'    => $username,
                'password'    => $hashed_password,
                'email'        => $email,
                'full_name' => $your_name,
                'last_ip'    => $this->ci->input->ip_address(),
            );

            if ($email_activation) {
                $data['new_email_key'] = md5(rand().microtime());
            }
            if (!is_null($res = $this->ci->users->create_user($data, !$email_activation))) {
                $data['user_id'] = $res['user_id'];
                $data['password'] = $password;
                unset($data['last_ip']);
                return $data;
            }
        }
        return NULL;
    }


All my controllers (that need user data) including auth extend MY_Controller
Code:
<?php

class MY_Controller extends Controller {


    function MY_Controller()
    {
    
        parent::Controller();
    
        $this->load->library('Tank_auth');
        
        $user_auth = array (
                            'is_logged_in'    => $this->tank_auth->is_logged_in(),
                            'user_id'         => $this->tank_auth->get_user_id(),
                            'role'             => $this->tank_auth->get_user_role(),
                            'full_name'     => $this->tank_auth->get_user_fullname(),
                           );
    
        
        $this->load->vars($user_auth);
        
    }

}

?>

Therefore login status, the users name and their role is available to all my view files without having to code it in every additional controller I make.

The reason I extended tank_auth rather than creating a new way of accessing the user_profiles table was that I didn't want to load additional libraries when I was already calling tank_auth, which was fulfilling 99% of the functionality I needed it to. Reduced the amount of code I had to write as well.

I have also changed all the view files, semantically coding login forms in a <table> is incorrect in my opinion! Using <fieldset> or even <ul> is a much cleaner way to style and display forms.

There is currently no way of modifying the users role, however I will add that functionality when I sort out the user management panel for the site admins.

If there are any better ways of doing it, please let me know

(and thanks to Ilya for writing a great library - filling in a massive gap in my knowledge!)

edit: Forgot the addition I made to the register() method in the auth.php controller
Code:
line 141: $this->form_validation->set_rules('your_name', 'Your Name', 'trim|required|xss_clean');

[eluser]stuckinphp[/eluser]
"So against all the principles I have read in the thread I have modified the users table and library to allow me to display info based on the users role."

Its ok my tank auth version has a postgres back end Wink

And my role session variable was called 'type'.

But btw everything you did makes sense. In hindsight I think a smarter move would be to include an extra function call in the login function which loads user profile data with an external or extensible model for use. That way it is always accessible info and much easier to handle / modify. Modifying the lib code is a total pain in the ass as it has a knock on effect to a million other files.




Theme © iAndrew 2016 - Forum software by © MyBB