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

[eluser]Ben Edmunds[/eluser]
gscharlemann,

No problem.

Thanks,

[eluser]goldpelican[/eluser]
Hi,

I've installed Ion Auth prety much "as-is" as a simple authentication layer for a web app I'm prototyping. I've noticed that there doesn't appear to be any verification of duplicate email addresses being provided in the registration process - or have I missed something? If I attempt to register a new user with an existing email address, I would expect to be notified - but I get redirected to the same login page after user creation as a successful registration, and I have to check the database to see that the new registration was not inserted - no feedback is given to the user.

Or is there? Not sure if I've broken something along the way, but I can't see any indication that the duplicate email registration attempt has failed (it doesn't overwrite the existing record, just doesn't get inserted). I couldn't find the code preventing the insert from happening - the field is not a primary key in the DB.

cheers

Ben

[eluser]Ben Edmunds[/eluser]
goldpelican,

The controller code is just a basic example. The library won't allow you to have duplicate identities but the best way to check and notify the user of this is with form_validation callbacks.

Below are the two callbacks I usually use:

Code:
/**
     * Username check
     *
     * @return bool
     * @author Ben Edmunds
     **/
    public function username_check($username)
    {
        if ($this->ion_auth->username_check($username))
        {
            $this->form_validation->set_message('username_check', 'The username "'.$username.'" already exists.');
            return FALSE;
        }
        else
        {
            return TRUE;
        }
    }
    
    /**
     * Email check
     *
     * @return bool
     * @author Ben Edmunds
     **/
    public function email_check($email)
    {
        if ($this->ion_auth->email_check($email))
        {
            $this->form_validation->set_message('email_check', 'The email "'.$email.'" already exists.');
            return FALSE;
        }
        else
        {
            return TRUE;
        }
    }

[eluser]farocco[/eluser]
Hello,

On the registration page, I need to capture Phone Number, Address.

Thanks

Frank

[eluser]Ben Edmunds[/eluser]
Frank,

Just add it to the meta table and the ion_auth config file and then pass it in with additional data when you register the user.

[eluser]farocco[/eluser]
Thanks Ben,

How do I pull the meta data in code?

[code}
$user = $this->ion_auth->get_user();
$user->??
[/code]

[eluser]Ben Edmunds[/eluser]
Frank,

For example, if you add address to the ion auth config file and the meta table you can do:

Code:
$user = $this->ion_auth->get_user();
echo $user->address;

[eluser]farocco[/eluser]
Thanks Ben....

So Easy....

Regards,

Frank

[eluser]Ben Edmunds[/eluser]
No problem Frank, glad to help Wink

[eluser]farocco[/eluser]
Ben,

Any thing I have to do to host this on Godaddy?
I am getting an email error when trying to use the forgot_password.

Thanks

Frank

A PHP Error was encountered

Severity: Warning

Message: mail() [function.mail]: Bad parameters to mail() function, mail not sent.

Filename: libraries/Email.php

Line Number: 1519

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /home/content/n/t/w/ntwfrankfort/html/ci/system/libraries/Exceptions.php:166)

Filename: libraries/Session.php

Line Number: 662

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /home/content/n/t/w/ntwfrankfort/html/ci/system/libraries/Exceptions.php:166)

Filename: helpers/url_helper.php

Line Number: 539




Theme © iAndrew 2016 - Forum software by © MyBB