ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Ion Auth - Lightweight Auth System based on Redux Auth 2

February 10, 2010 7:00pm

Subscribe [287]
  • #241 / Apr 27, 2010 11:11pm

    Ben Edmunds

    812 posts

    gscharlemann,

    No problem.

    Thanks,

  • #242 / May 02, 2010 4:17am

    goldpelican

    4 posts

    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

  • #243 / May 02, 2010 3:18pm

    Ben Edmunds

    812 posts

    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:

    /**
         * 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;
            }
        }
  • #244 / May 03, 2010 1:23pm

    farocco

    22 posts

    Hello,

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

    Thanks

    Frank

  • #245 / May 03, 2010 3:29pm

    Ben Edmunds

    812 posts

    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.

  • #246 / May 03, 2010 3:59pm

    farocco

    22 posts

    Thanks Ben,

    How do I pull the meta data in code?

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

  • #247 / May 03, 2010 4:56pm

    Ben Edmunds

    812 posts

    Frank,

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

    $user = $this->ion_auth->get_user();
    echo $user->address;
  • #248 / May 03, 2010 5:08pm

    farocco

    22 posts

    Thanks Ben….

    So Easy….

    Regards,

    Frank

  • #249 / May 03, 2010 5:09pm

    Ben Edmunds

    812 posts

    No problem Frank, glad to help 😉

  • #250 / May 03, 2010 5:16pm

    farocco

    22 posts

    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

  • #251 / May 03, 2010 6:09pm

    2think

    125 posts

    farocco,

    The last two errors are because you’re sending information in your controller. If you post that code, I’m sure someone can help you. I’m thinking (and this could be quite inaccurate since I can’t see your controller code) that you have a redirect first or early in your controller?

    I don’t know if Ben has changed anything in his mail sending functions because it doesn’t seem like there’s a problem, at least from the code I’ve been using. Have you checked to make sure that GoDaddy has a mail server for you to use? I’m sure they do but as I said, with the mail sending functions not giving me a problem, just wondering what it could be on your end.

  • #252 / May 03, 2010 8:02pm

    farocco

    22 posts

    I changed the auth.php forgot_password to use templates.
      $this->data[‘title’] = ‘Forgot Password’;
            $this->data[‘content’] = ‘auth/forgot_password’; 
            $this->load->view(‘includes/template’, $this->data); 

    The code below was the orginal.
            //$this->load->view(‘auth/forgot_password’, $this->data);

  • #253 / May 03, 2010 9:12pm

    Frank Rocco

    109 posts

    I just tried removing the template from auth.php, but still get the error.

  • #254 / May 03, 2010 9:13pm

    Timothy_

    100 posts

    Hello,

    Firstly. Thank-you Ben for taking up the challenge to make a clean, fast and stable authentication library.

    I am currently at the pointy end of releasing v1.0 of a project that uses redux auth 2 Beta. I have thrashed through some issues but have now realised I need to move to Ion Auth.

    Does anyone have any tips on moving from Redux Auth 2 to Ion Auth.

    I am excited to move to a better authentication library but am daunted by the amount of code I am going to have to change.

    Thanks

    Tim

  • #255 / May 03, 2010 9:39pm

    Frank Rocco

    109 posts

    I just changed the ion_auth library email mailtype to $config[‘mailtype’] = “text”;
    And it works. So it is failing on the html setting.

    Any ideas?

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases