CodeIgniter Forums
MeNeedz Auth - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: MeNeedz Auth (/showthread.php?tid=13058)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20


MeNeedz Auth - El Forum - 11-22-2008

[eluser]sankai[/eluser]
hi,waldmeister.

if my table PK field use the string that create by uuid() like '1225c695-cfb8-4ebb-aaaa-80da344e8352';

May I set it before $this->auth->register()?


MeNeedz Auth - El Forum - 11-22-2008

[eluser]davidbehler[/eluser]
Ok, so far I hadn't thought of that case, but you are right it could be usefull to be able to set the pk field in advance without the use of auto increment.

I have updated the library to allow you to add a hidden field to the registration form that holds the value for the user pk field. To do this you have to do this:
- get the new version of the library. you might notice that there are 2 more options in the database/input config
- set the new option in the database config for the user table 'user_primary_key_column_is_auto_increment' to FALSE
- set the new option in the input config for your registration form 'primary_key' to the name of the hidden field that holds the pk for the new user

I hope that works for you. Tell me if you need anything else Smile


MeNeedz Auth - El Forum - 11-22-2008

[eluser]sankai[/eluser]
Yes!! :cheese:
It will become more flexible.
thank you so much!! Smile

but...I just download the auth.rar again.
It still be old version?
I can't find the new option user_primary_key_column_is_auto_increment and primary_key

I await the new version released!


MeNeedz Auth - El Forum - 11-22-2008

[eluser]davidbehler[/eluser]
I have reuploaded the archive.
Works for me now Smile


MeNeedz Auth - El Forum - 11-24-2008

[eluser]Unknown[/eluser]
Hi. Congratulations for your lib, I've been testing it and it looks good.

I've found a little error when working with it, related to "session" null when using without a database. I've changed line 142 of Auth.php from:

Code:
$this->session->set_userdata('user', $this->non_database_user_identifier);

to

Code:
$this->CI->session->set_userdata('user', $this->non_database_user_identifier);

and now it's working fine.

Besides that, there was also one thing I changed in the sample you showed in the user guide - there was a call to "redirect('welcome/login')" and it was necessary to load 'url' helper... firstly, I thought it was wrong, but it was my fault - sorry, just learning CI... do you load these helpers by default?

Please let me know if the issues I reported are related to my errors or changes needed to be done in MeNeedz lib.

Best regards, Daniel


MeNeedz Auth - El Forum - 11-24-2008

[eluser]davidbehler[/eluser]
Thanks for pointing out the error. I fixed it and uploaded the new version.

Yeah, I usually load helpers by default if I need them often (e.g. the url helper). But I have just updated the guide to include the loading of the helper in the example to make it easier for starters!

Glad you like my library Smile


MeNeedz Auth - El Forum - 11-25-2008

[eluser]sankai[/eluser]
hi,waldmeister Smile

...I enjoy your library


MeNeedz Auth - El Forum - 11-26-2008

[eluser]ray73864[/eluser]
just setting up the auth library now for my CMS, and i was wondering if there was a way of not using the salt feature?

from what i can gather if i just do:

Code:
$config['encryption_order'] = %password%

it should work, is this all i have to do?


MeNeedz Auth - El Forum - 11-26-2008

[eluser]ray73864[/eluser]
ok, so i have gotten that worked out, but now in my 'dashboard' controller it is doing a 'has_access' but it is coming back with:

A PHP Error was encountered

Severity: Notice

Message: Undefined index: group_table

Filename: libraries/Auth.php

Line Number: 468

my config/auth.php file:

Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

    $config['input_config'] = array(
        'login' =>     array(
                'identifier' => 'username', //name of the input that holds the identifier used for login
                'password' => 'password', //name of the input that holds the password used for login
                'remember' => 'remember_me' //name of the checkbox that says wether to remember the user or not
            )
    );
    
    $config['database_config'] = array(
        'user_table' => array(
            'name' => 'fa_user',
            'user_primary_key_column' => 'ID',
            'user_primary_key_column_is_auto_increment' => true,
            'user_identifier_column' => 'username',
            'user_password_column' => 'password',
            'user_salt_column' => ''
        ),
        'member_table' => array (
            'name' => 'member',
            'group_foreign_key_column' => 'group_id',
            'user_foreign_key_column' => 'user_id'
        )
    );
    
    $config['encryption_order'] = '%password%';
    
    $config['use_database'] = TRUE;
    $config['use_database_user_groups'] = FALSE;
    $config['use_database_rights'] = FALSE;

/* End of file database.php */
/* Location: ./system/application/config/auth.php */

my controller/dashboard.php file:

Code:
function index()
    {  
        if ($this->auth->has_access('admin'))
        {
            $data['settings'] = $this->settings;
            $data['the_page'] = 'admin/admin';
            
            $this->load->view('layout', $data);
        }
    }



MeNeedz Auth - El Forum - 11-26-2008

[eluser]davidbehler[/eluser]
I found and fixed the error.
But if you want to change the default database or input config, you should always copy the whole array to your config file and make your changes and not just take the part you want to change.

Download is updated.