EzDevInfo.com

Tank-Auth

Tank Auth is an authentication library for PHP-framework CodeIgniter. It's based on DX Auth, althouth the code was seriously reworked. Tank Auth: Authentication library for CodeIgniter tank auth is an authentication library for php-framework codeigniter. it's very compact, fast and reliable.

Codeigniter tank auth

I am wondering if someone can help me, I have recently moved my site live to test it so I basically copied the database and uploaded the files. This means that I had already set up a user account on my local server. However, I have found the login to be a bit temperamental, when I went to login it wouldn’t accept it so I had to reset my password which it then worked fine. Then I decided to register another user and that worked fine however I went to log in the next day and it wouldn’t let me, even though I know that the details were correct…

Has anyone else experienced something similar? Also, if you have, how did you fix it?

Thanks


Source: (StackOverflow)

Setting up Codeigniter HMVC with tank auth

I am having trouble getting a working Codeigniter version 2.0.3 with hmvc and tank auth(set up as a module) setup properly. I have installed CI properlly and then install HMVC with these directions https://bitbucket.org/wiredesignz/codeigniter-modular-extensions-hmvc/wiki/Home

I get to my welcome controller/view as example just fine which means the HMVC is working. Next I try to add tank auth to the project by adding it to a folder in the modules folder. It has the proper controller/view/model etc.. setup within the tank auth. I even added in routes something like

$route["auth"]="auth/login";

I also extended the controller within the auth module to MX_Controller like as directed. Also in the constructor I have :

$this->load->helper(array('form', 'url'));
    $this->load->library('form_validation');
    $this->load->library('security'); <--failing to load this

    $this->load->library('tank_auth');
    $this->lang->load('tank_auth');
     $this->form_validation->CI =& $this;

It seems to be redirecting fine to the module however it comes up with an error saying ::

An Error Was Encountered

Unable to load the requested class: security

What am I doing wrong? Does any one have a working CI installation with HMVC and tank auth as a module so I can see how its done? I'm new to HMVC, thanks


Source: (StackOverflow)

Advertisements

Tank Auth login successful on local, fails on server

I am using Tank Auth for Codeigniter to facilitate user registration and login.

Problem: I am able to login perfectly using tank auth on my local Windows development server (XAMPP). However when I copied the entire database and entire directory structure to my remote server, updated config/config.php and config/database.php with my remote server details, I can no longer login with Tank Auth! The error given is an incorrect password. Using PHPMyAdmin, I resetted the password using the MD5() function but I still cannot login.

Any idea what went wrong, or how you manage to solve it?

EDIT: IF I register a new user on the remote site, its login will work!! I still need to know how to solve this problem as I may be changing servers soon.


Source: (StackOverflow)

CodeIgniter Tank Auth

I am making use of this excellent library called Tank Auth. Hopefully this question won't be too niche as its specific to this library.

I am trying to work how I can login a user as soon as they have registered. It seems this library doesn't offer this functionality and I don't want to start messing with the library but maybe someone has done this already and can describe a non-hackey way of getting this to work?

Thanks all for any help.


Source: (StackOverflow)

Codeigniter TankAuth: How to move database to new server with phpass hash portable set to FALSE

TankAuth uses PHPass for password hashing with portable mode set to FALSE by default that lets PHPass uses bcript instead since portable hashes does not store salt in its hash.

But, if we want to move the database to different server, we need to set it to TRUE even before adding records to table to avoid regenerating the passwords later. Evidently, keeping portable hashes TRUE makes the encrypted passwords is quite unsafe

Is there any better solution using tank auth to bcrypt the password hash yet painless database migration across servers?


Source: (StackOverflow)

Flexi Auth or Tank Auth for codeigniter auth library [closed]

Which one is better Tank Auth or Flexi Auth. Which one should I pick. has anyone used anyone of these and can provide some feedback


Source: (StackOverflow)

How to keep session data using Codeigniter and Tank Auth

I'm using Codeigniter and Tank Auth for a e-commerce website. I'm finding that if a customer puts items into the cart (using the Codeigniter built in cart class) and then registers on the site the session is lost along with their cart (I'm presuming it generates a new session for some reason instead of keeping the same session).

Has anyone come across this problem before? and is there a simply solution that I have overlooked.

Thanks


Source: (StackOverflow)

Best approach to create Tank_Auth in CI

I just installed Tank_Auth in Codeigniter and would like to develop a CMS and to know what is the best approach to create an admin account and client account. Do I have to separate one CI directory and controller for a public website and another CI directory controller for the Admin and Client auth?

Ex: My client has a website so everyone (public) can see the contents. It works fine. I want the admin, client and some of their associated to access Create, Update, Delete contents. How would I do that?


Source: (StackOverflow)

How do I set a return URL during login on Codeigniter / Tank_Auth?

The issue here is that when my user logs into my app, they always are redirected to the default controller.

I would like the user to be redirected to the page they were on before logging in.

So for example, if the user is reading forum post #12 (reading does not require login) and then decides to post an answer (answering requires login), once they login they should go back to post #12.

I am using PHP/Codeigniter 2.0.2 and the Tank_Auth library, and have in several of my controllers

function __construct()
{
    parent::__construct();

    if (!$this->tank_auth->is_logged_in()) {
        redirect('/auth/login/');
    } else {

        //load stuff 
     }

My question is

What is the best way to set a return URL (Cookie? GET?), and how would that be implemented?

If you're familiar with Tank_Auth, in which files should I make these changes?

Any roadmaps are welcome, even if you don't use Tank_Auth.


Source: (StackOverflow)

Tank Auth - getting the user info from the database

I've created a function which withdraw the user data from the database:

function user()
{
    $user_id = $this->ci->session->userdata('user_id');

    if (!is_null($user = $this->ci->users->get_user_by_id($user_id, TRUE))) {
        return $this->ci->users->get_user($user_id); //model
    }
    return FALSE;
}

I'm using it like this in any controller:

$this->tank_auth->user()->field.

Its not convenient for me, so what I need to do, to get the user data like this?

$this->user->field or $this->tank_auth->user->field.

My second question, regarding the above function is this function:

function is_admin()
{
    if ( $this->user()->who )
    {
        return $this->user()->who === "ADMIN";
    }
    return FALSE;
}

It does throw error:

A PHP Error was encountered

Severity: Notice

Message: Trying to get property of non-object

Filename: libraries/Tank_auth.php

Line Number: 335

(Line 335 is if ( $this->user()->who )).

Why does this happend? Both functions are located in the tank_auth's library, so its supposed to work fine, but it doesnt.

I'll appreciate any help attempt.


Source: (StackOverflow)

Sending Mail From localhost using Tank Auth in codeIgnitor

I am using my localhost in port 81. I have tried to modify my php.ini and sendmail.ini file to send mail from my localhost. But it shows the message was gone successfully but can't find the message in inbox. here is my [mail function] of php.ini file.

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost:81
; http://php.net/smtp-port
smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = postmaster@localhost 
sendmail_from =mymail@gmail.com
;above was commented/replaced

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = "\"\xampp\sendmail\sendmail.exe\" -t" 
;above was commented

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = Off

; Log all mail() calls including the full path of the script, line #, to address and headers
;mail.log = "\xampp\apache\logs\php_mail.log"

and here is my sendmail.ini file:

[sendmail]

smtp_server=localhost:81
smtp_port=25
error_logfile=error.log
debug_logfile=debug.log
auth_username=mymail@gmail.com
auth_password=*****
force_sender=mymail@gmail.com

I am using Xampp server. it's version is XAMPP 1.7.3! And my Php version is :[PHP: 5.3.1].And i am using this tankauth library .And my default directory of Xampp is in D:\xampp folder.


Source: (StackOverflow)

HMVC and Views in folders (Codeigniter)

I am using Tank Auth library in Codeigniter with HMVC and the entire tank auth mvc files are in its own module called 'auth'. tank auth loads a view (domain.com/application/modules/auth/views/auth/login_form.php) found inside a folder (auth) using:

$this->load->view('auth/login_form', $data);

As far as I know the above code will load login_form.php inside the auth folder properly without HMVC. However with HMVC, I need the following code to get the view to load:

$this->load->view('auth/auth/login_form', $data);

Is there a setting that we should change so we dont have to refer to the view file by (module name)/(views folder name)/(view filename) ? Or is this perfectly normal and most people does it this way?

It seems troublesome that I have to add the module folder name 'auth' to every view() function call, and change all of them should I change the name of the module folder.


Source: (StackOverflow)

CodeIgniter tankauth not working with GMail

I've WAMP server setup on local dev environment (php_openssl extension enabled). I installed Code Igniter and trying to configure TankAuth, where I want to use GMail (actually Google Apps) to send test mails.

I went through following URLs for configuration

Based on input from above, I updated _send_email function of tank auth as follow

function _send_email($type, $email, &$data)
{
    $this->load->library('email');

    $config['protocol'] = "smtp";
    $config['smtp_host'] = "ssl://smtp.googlemail.com";
    $config['smtp_port'] = "465";
    $config['smtp_user'] = "mymail@youthpark.org";//also valid for Google Apps Accounts
    $config['smtp_pass'] = "mypass";
    $config['charset'] = "utf-8";
    $config['mailtype'] = "html";
    $config['newline'] = "\r\n";

    $this->email->initialize($config); 

    $this->email->from($this->config->item('webmaster_email', 'tank_auth'), $this->config->item('website_name', 'tank_auth'));
    $this->email->reply_to($this->config->item('webmaster_email', 'tank_auth'), $this->config->item('website_name', 'tank_auth'));
    $this->email->to($email);
    $this->email->subject(sprintf($this->lang->line('auth_subject_'.$type), $this->config->item('website_name', 'tank_auth')));
    $this->email->message($this->load->view('email/'.$type.'-html', $data, TRUE));
    $this->email->set_alt_message($this->load->view('email/'.$type.'-txt', $data, TRUE));
    //$this->email->send();

    if ( ! $this->email->send())
    {
        show_error($this->email->print_debugger());
    } else {
        //echo('DONE');        
    } 
}

I'm getting message mail sent.. but actually mail was not sent. Can someone please point-out where I'm doing the mistake?

Popup is also enabled in GMail settings


Source: (StackOverflow)

Codeigniter tank auth - user gets logged out for no known reason

I am using the codeigniter tank auth library for working with users and it has been working great. Whenever I try to access any controller, the function checks if the user is logged in like this:

if($this->tank_auth->is_logged_in()) {

If it's logged, I load the model but if not, I do a redirect to the login page. It has been working like this for one month but now I'm extending my application and built some other controllers that uses the same technique but the files are located in other folder. The previous working application still works great but in this app from the new folder (it's basically a new module for that application, uses the same login page but redirects differently according to user selection of the module) I can login correctly, I can make a any request to the controller with no problems but at some point, it tells me the user is not logged in. It's not the session expired or something, it's like I'm making one request now, extending my session and the next at 3 seconds interval gets the user logged out...I've done nothing different with my new controllers, but still, after a while, sometimes it takes 5 minutes, sometimes 15 minutes, it logs out...I don't know why, is something messing with my session ? I don't use session for anything else...

Anybody knows what this is about ? Or any suggestion ? I can give further details if requested.

Thank you very much.

EDIT: The new module consists in more controllers in the same Codeigniter instalation, it works with the same CI config, same tank auth library and the functions are copied to the main requests controller like this:

class Requests extends Controller
{
    function __construct()

    {
        parent::__construct();

        $this->load->helper(array('form', 'url'));
        $this->load->helper('date');
        $this->load->library('form_validation');
        $this->load->library('tank_auth');
    }

..............
more functions
..............

    function getServices() { /// One of the functions that the new module uses
            if (!$this->tank_auth->is_logged_in()) {
                return;
            } else {
                $this->load->model('requests/getServices');
                $data['tid'] = $_POST['tid'];
                $this->getServices->showData($data);
            }

        }

Source: (StackOverflow)

CodeIgniter Tank Auth - problem with send_again function

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!


Source: (StackOverflow)