Welcome Guest, Not a member yet? Register   Sign In
Community Auth Learning...
#41

And the method in line number 175 under auth_model.php
Is this,
Code:
    /**
     * Clear user holds that have expired
     */
    public function clear_expired_holds()
    {
        $expiration = date('Y-m-d H:i:s', time() - config_item('seconds_on_hold') );

        $this->db->delete( config_item('IP_hold_table'), array( 'time <' => $expiration ) );

        $this->db->delete( config_item('username_or_email_hold_table'), array( 'time <' => $expiration ) );
    }
Reply
#42

Delete is a method from CI's database classes, and the error you are seeing indicates that either db was unset or never loaded. It's likely that this was a problem with the server / MySQL. Are you having other problems with MySQL?
Reply
#43

FYI, this is my testing environment.
I'm using XAMPP with MariaDB it works the same with MySQL, since they ditch MySQL and replaced it with MariaDB.

I restarted XAMPP and turned on apache and MySQL (MariaDB) and visited this link below
http://localhost/phpmyadmin/

and no error show up, meaning MariaDB is working fine.
Currently using InnoDB engine in MariaDB, by the way InnoDB is also called xTraDB in MariaDB.

Perhaps you can try the latest XAMPP to test Community-Auth under it since MySQL is really getting rusty.
https://www.apachefriends.org/index.html

Will try to find out at my end as well the culprit.
Just in case you fixed the bug let me know as well.

thanks in advance.
Reply
#44

(This post was last modified: 11-30-2015, 07:53 PM by solidcodes.)

Okay no worries for that bug I found the culprit.
I Just remove these redundant methods that I incorporated last night.
Code:
public function __set($tableName, $value)
    {
        if (property_exists($this, $tableName)) {
            $this->$tableName = $value;
        }
        return $this;
    }    
    
    public function __get($tableName)
    {
        if (property_exists($this, $tableName)) {
            return $this->$tableName;
        }
    }

bug fixed
Reply
#45

(11-30-2015, 07:33 PM)solidcodes Wrote: FYI, this is my testing environment.
I'm using XAMPP with MariaDB it works the same with MySQL, since they ditch MySQL and replaced it with MariaDB.

I restarted XAMPP and turned on apache and MySQL (MariaDB) and visited this link below
http://localhost/phpmyadmin/

and no error show up, meaning MariaDB is working fine.
Currently using InnoDB engine in MariaDB, by the way InnoDB is also called xTraDB in MariaDB.

Perhaps you can try the latest XAMPP to test Community-Auth under it since MySQL is really getting rusty.
https://www.apachefriends.org/index.html

Will try to find out at my end as well the culprit.
Just in case you fixed the bug let me know as well.

thanks in advance.

I've been curious about MariaDB, but never worked on a production environment that had it, so never had it on my development environment. I'm running all my development environments on Ubuntu (Linux) as of 13 months ago. I'm sure setting up MariaDB is super easy, so one of these days I'll check it out.

I rarely have issues with MySQL, and you say it is "really getting rusty". What do you mean by that? Is it not well maintained anymore? What do you think are the best benefits of MariaDB?

I guess this is way off topic now. Maybe you can just send me a private message.
Reply
#46

sent you message check your private inbox.
Reply
#47

By the way how do I call one of the method in /third-party/community-auth/libraries/authentication.php inside my custom made controller?

thanks in advance.
Reply
#48

(This post was last modified: 12-01-2015, 06:37 PM by solidcodes.)

I want to match the 'pass_string' a.k.a. password from the form versus the password currently inside the databse.
So far this is what I did.
Code:
public function show_pass_salt()
    {
        $this->load->library('authentication');
        
        $password = 'Retinitis9';
        $random_salt = $this->authentication->random_salt();
        
         $pwd = $this->authentication->hash_passwd($password, $random_salt);
         echo $pwd;
        
    }

Eventhough one of the password in the DB is 'Retinitis9' it did not match one of them.
What's the proper way to match the password from a form versus the current password in the DB.

thanks in advance.
Reply
#49

(12-01-2015, 06:35 PM)solidcodes Wrote: I want to match the 'pass_string' a.k.a. password from the form versus the password currently inside the databse.
So far this is what I did.
Code:
   public function show_pass_salt()
   {
       $this->load->library('authentication');
       
       $password = 'Retinitis9';
       $random_salt = $this->authentication->random_salt();
       
        $pwd = $this->authentication->hash_passwd($password, $random_salt);
        echo $pwd;
       
   }

Eventhough one of the password in the DB is  'Retinitis9' it did not match one of them.
What's the proper way to match the password from a form versus the current password in the DB.

thanks in advance.

The proper way to check if the password matches a specific user would be to get the user's hashed password and salt from the user's table, and with the password you want to check call the authentication libraries check_passwd method:



PHP Code:
$pwd 'Retinitis9';

// A user's ID; for example user ID #24
$user_id 24;

$query $this->db->select('user_pass,user_salt')
    ->fromconfig_item('user_table') )
    ->where'user_id'$user_id )
    ->get();

if( 
$query->num_rows() == )
{
    $row $query->row_array();

    $password_match $this->authentication->check_passwd(
        $row['user_pass'],
        $row['user_salt'],
        $pwd
    
);

    // Bool
    var_dump$password_match );


If you need to check a bunch of different users to see if the password matches one of theirs, you might do something like this:

PHP Code:
$pwd 'Retinitis9';

$query $this->db->select('user_id,user_pass,user_salt')
    ->fromconfig_item('user_table') )
    ->get();

if( 
$query->num_rows() > )
{
    foreach$query->result_array() as $row )
    {
        $password_match $this->authentication->check_passwd(
            $row['user_pass'],
            $row['user_salt'],
            $pwd
        
);

        if$password_match )
        {
            echo $pwd ' was the correct password for user #' $row['user_id'];
            break;
        }
    }

Reply
#50

Okay thanks I will try those.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB