Welcome Guest, Not a member yet? Register   Sign In
flexi auth - A user authentication library for CodeIgniter

[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


Messages In This Thread
flexi auth - A user authentication library for CodeIgniter - by El Forum - 12-21-2012, 09:55 AM



Theme © iAndrew 2016 - Forum software by © MyBB