Welcome Guest, Not a member yet? Register   Sign In
Ion Auth - Lightweight Auth System based on Redux Auth 2

[eluser]Ben Edmunds[/eluser]
dreamer111,

Yes it does. Please post your ion_auth settings file and your meta schema.

[eluser]dreamer111[/eluser]
Thanks Ben
Schema was taken directly from latest github file:
benedmunds-CodeIgniter-Ion-Auth-235b81d.zip
here is settings file:
$config['tables']['groups'] = 'groups';
$config['tables']['users'] = 'users';
$config['tables']['meta'] = 'meta';
$config['site_title'] = "www.example.com";
$config['admin_email'] = "admin@admin.com";
$config['default_group'] = 'members';
$config['admin_group'] = 'admin';
$config['join'] = 'user_id';
$config['columns'] = array('first_name', 'last_name', 'company', 'phone');
$config['identity'] = 'email';
$config['min_password_length'] = 8;
$config['max_password_length'] = 20;
$config['email_activation'] = false;
$config['remember_users'] = true;
$config['user_expire'] = 7200;
$config['user_extend_on_login'] = false;
$config['email_templates'] = 'inserts/ionauthemails/';
$config['email_activate'] = 'activate.tpl.php';
$config['email_forgot_password'] = 'forgot_password.tpl.php';
$config['email_forgot_password_complete'] = 'new_password.tpl.php';
$config['salt_length'] = 10;
$config['store_salt'] = false;
$config['message_start_delimiter'] = '<p>';
$config['message_end_delimiter'] = '</p>';
$config['error_start_delimiter'] = '<p>';
$config['error_end_delimiter'] = '</p>';

Yep. it's weird. Everything seems to be correct to me.

[eluser]dreamer111[/eluser]
Ghmm. never mind. Smile
just got everything working. Not sure what was wrong though.
Just replaced library/model and it worked. I get meta data now.
Thanks for replies Ben.

Turns out problem was with notepad++ dbgp plugin that I use for php edbugging.
For some reason it was only showing part of the data.
dunno how this is even possible.

[eluser]InsiteFX[/eluser]
Hi Ben,

As I said above, some how the users are entering ( + - etc ) and other characters that should not be
allowed in the email address. I'll I see if I can fix it and then post it here.

Thanks Ben
InsiteFX

[eluser]Sinclair[/eluser]
About the password generation...

Code:
public function salt()
    {
        return substr(md5(uniqid(rand(), true)), 0, 10);
    }


    public function hash_password($password, $salt=false)
    {
        if (empty($password))
        {
            return FALSE;
        }

        if (FALSE && $salt)
        {
            return  sha1($password . $salt);
        }
        else
        {
            $salt = $this->salt();
            return  $salt . substr(sha1($salt . $password), 0, -10);
        }
    }

By default, what part of the code run? "return sha1($password . $salt);" or "return $salt . substr(sha1($salt . $password), 0, -10);" ?

I'am struggling to get the password generation running in a Database procedure whitout success until now.

Best Regards,

[eluser]Sinclair[/eluser]
Ok done with the password hashing in PostgreSQL.

To hash passwords like this:
Code:
return  $salt . substr(sha1($salt . $password), 0, -10);

We need two functions in PlpgSQL:

Code:
CREATE OR REPLACE FUNCTION sha1(bytea) returns text AS $$
      SELECT encode(digest($1, 'sha1'), 'hex')
    $$ LANGUAGE SQL STRICT IMMUTABLE;

Code:
CREATE OR REPLACE FUNCTION "public"."hash_password" (pPASSWORD varchar) RETURNS varchar AS
$body$    
    DECLARE
    pPASSWORD                     alias for $1;
    vSALT                        varchar;
    vTO_HASH                    bytea;
    vHASHED                        varchar;

    
    BEGIN
    select INTO vSALT substr(gen_salt('md5'), 0, 10) as salt;

    vTO_HASH := vSALT || pPASSWORD;
    SELECT INTO vHASHED vSALT || substr(sha1(vTO_HASH), 0, 30) as hashed;
    
    RETURN vHASHED;
    END;
$body$
LANGUAGE 'plpgsql' VOLATILE RETURNS NULL ON NULL INPUT SECURITY DEFINER;

Then we can call the HASH_PASSWORD function, just like:
Code:
select hash_password('123456789')

Just in case that someone need to generate users in the database(PostgreSQL).

Best Regards,

[eluser]Ben Edmunds[/eluser]
Thanks for posting the solution Sinclair

[eluser]huuray[/eluser]
how to check whether is user logged or not in view?

[eluser]Ben Edmunds[/eluser]
huuray,

Some people make an auth helper that just returns ion_auth->logged_in() but I usually create a user object in a MY_Controller and pass that to every view. Then in the view I can just make sure the user object isn't empty.

[eluser]huuray[/eluser]
thanks ben,
i think ion auth need a wiki Wink




Theme © iAndrew 2016 - Forum software by © MyBB