CodeIgniter Forums
flexi auth - A user authentication library for CodeIgniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forum-22.html)
+--- Thread: flexi auth - A user authentication library for CodeIgniter (/thread-54581.html)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34


flexi auth - A user authentication library for CodeIgniter - El Forum - 12-19-2012

[eluser]haseydesign[/eluser]
Awesome work xuma!
Again, thanks for posting your solution to help others in future.


flexi auth - A user authentication library for CodeIgniter - El Forum - 12-21-2012

[eluser]TheCry[/eluser]
Hi..
I'd started to work with your library and i like it..
But at the moment i have a problem and i don't understand what i do wrong.
I want to change the password of a member as Administrator.
My Form sends the new password with "uacc_password".. The model works and the post variable arrives.

Now i want to use your functions in flexi-auth model to generate a new hashed password and store it to the database...
But the hashed password is not correct and the user can't login...
Now i stored as admin the known password again, but the hash is not equal them the hash with works.
Here is the code from my model for the change password as admin:
Code:
<?php
$CI =& get_instance();
                    $CI->load->model('flexi_auth_model');

                    // Get users salt.
                    $sql_select = $this->flexi_auth->db_column('user_acc', 'salt');
                    $sql_where = array(
                        $this->flexi_auth->db_column('user_acc', 'id') => $user_id
                    );
                    $user = $this->flexi_auth->get_users($sql_select, $sql_where)->row();

                    $hash_password = $CI->flexi_auth_model->generate_hash_token($this->input->post('uacc_password'), $user->{$this->auth->database_config['user_acc']['columns']['salt']}, TRUE);

                    $login_data = array(
                        $this->flexi_auth->db_column('user_acc', 'password') => $hash_password,
                        $this->flexi_auth->db_column('user_acc', 'username') => $this->input->post('uacc_username'),
                        $this->flexi_auth->db_column('user_acc', 'suspend') => ($this->input->post('uacc_suspend')) ? '1' : '0'
                    );
$this->flexi_auth->update_user($user_id, $login_data);
?>
Where is the error?
I hope you can help me..

Thanks
Sascha


flexi auth - A user authentication library for CodeIgniter - El Forum - 12-23-2012

[eluser]Drumm[/eluser]
Flexi auth looks really cool! Having a hard time implementing it, bit of a beginner to CI.

I am seeing the same warning as katanama about:
"<p>Severity: Warning</p>
<p>Message: Creating default object from empty value</p>
<p>Filename: models/flexi_auth_lite_model.php</p>
<p>Line Number: 47</p>"

However, I am not using HMVC. Again, the line in question is: $this->auth->session_name = $this->config->item('sessions','flexi_auth');

I'm not sure in any way about what is causing this. Would you be able to give me some pointers?


flexi auth - A user authentication library for CodeIgniter - El Forum - 12-26-2012

[eluser]finalan[/eluser]
Merry Christmas,

@haseydesign: thanx for the clean code and nice work.

For testing purposes i installed the demo version of your library (xampp). It works fine, but now i'm facing following error, if i want to visit the "Lite library"-Site as "Public"-User:

A PHP Error was encountered
Severity: Notice
Message: Undefined index: upro_first_name
Filename: controllers/auth_lite.php
Line Number: 77

A PHP Error was encountered
Severity: Notice
Message: Undefined index: upro_last_name
Filename: controllers/auth_lite.php
Line Number: 77

A PHP Error was encountered
Severity: Notice
Message: Undefined index: upro_phone
Filename: controllers/auth_lite.php
Line Number: 78

Its the following code:
$user = $this->flexi_auth->get_user_by_id_row_array();
$this->data['user_full_name'] = (!empty($user)) ? $user['upro_first_name'].' '.$user['upro_last_name'] : null;
$this->data['user_phone'] =(!empty($user)) ? $user['upro_phone'] : null;

Where i couldn't find the 'get_user_by_id_row_array'-function? Am i missing something or should i clean my glasses?

Best regards,
Firat


flexi auth - A user authentication library for CodeIgniter - El Forum - 12-26-2012

[eluser]Drumm[/eluser]
@finalan, upro_last_name and whatnot are references to custom fields. If you go into the demo folders, and view the SQL + flexi_auth.php config file, you will seem them defined in there.

If you don't plan to use those custom fields, best thing is to remove references to them Smile.


flexi auth - A user authentication library for CodeIgniter - El Forum - 12-26-2012

[eluser]finalan[/eluser]
[quote author="Drumm" date="1356528189"]@finalan, upro_last_name and whatnot are references to custom fields. If you go into the demo folders, and view the SQL + flexi_auth.php config file, you will seem them defined in there.

If you don't plan to use those custom fields, best thing is to remove references to them Smile. [/quote]

Thx, Drumm. Thats it. I copied the wrong config-file. With the Demo "config/flexi_auth.php" it works like a charm.

You saved my day :-)


flexi auth - A user authentication library for CodeIgniter - El Forum - 12-27-2012

[eluser]zawaruddin[/eluser]
well, it will be grateful if i can download the user guide too... Big Grin


flexi auth - A user authentication library for CodeIgniter - El Forum - 01-02-2013

[eluser]haseydesign[/eluser]
@TheCry

Your problem is that you are using the model files within the flexi auth library instead of the 'application/library' files.
Methods/functions within the flexi auth model are ONLY meant to be used by the library files and should not be directly called by yourself.
So basically you're making extra work for yourself that is already handled by the libraries 'update_user()' and/or 'change_password()' functions.

From your comment, you seem to suggest that you need to update the password of another user, in which case you should use the update_user() function.

If you want to allow users to change their own password, then you can alternatively use the change_password() function, which requires the users current password and new password to validate they are the genuine user for that account.

Examples using these functions are available in both help guide links above.
For both functions, you do not need to hash the password, this is done automatically by the library, you just need to submit it to the function in plain text.


@Drumm

I'm guessing you may have solved this by now, but anyhow.
The problem you were getting is most likely that you hadn't defined the global '$this->auth' object prior to loading the library.

Code:
$this->auth = new stdClass;
$this->load->library('flexi_auth_lite', FALSE, 'flexi_auth');


@finalan

It looks like @Drumm help you solved your problem, drop me a message if your still having trouble.
Thanks @Drumm for helping out!


@zawaruddin

If you install the demo on your local computer, then you can access the user guide locally.
The reason it isn't available as a standalone guide, is that some user guide examples actually use live data from your current demo session to return live example data.



flexi auth - A user authentication library for CodeIgniter - El Forum - 01-03-2013

[eluser]TheCry[/eluser]
@haseydesign
Thank you very much for explaining... Now everything is clear... It works now fine


flexi auth - A user authentication library for CodeIgniter - El Forum - 01-05-2013

[eluser]RichM[/eluser]
What php version is required?

I've got everything working on my local wamp installation, but when moving to server I'm unable to login. I've modified all the proper files with new config and db settings, but keeps telling me that my submitted login details are incorrect.

The only difference I see between the 2 setups is the local version is using 5.3.13 and online server is using 5.2.17.

Any help is greatly appreciated.

**UPDATE** Please disregard. Had server upgraded to PHP 5.3 and all is good.