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]
  • #1246 / Jul 17, 2012 1:34pm

    Miguel Suárez

    6 posts

    Hi, I have a problem, I cant seem to update the user’s password from within a form:

    This is the code I’m using, it updates the other fields fine:

    $id = $this->input->post('userId');
    
    $data = array(
     'first_name' => $this->input->post('first_name'),
     'last_name' => $this->input->post('last_name'),
     'username' => $this->input->post('username'),
     'password' => $this->input->post('password'),
     'email' => $this->input->post('email')
    );
    
    $this->ion_auth->update($id, $data);
    
    ;

    What am I doing wrong?

  • #1247 / Jul 17, 2012 1:39pm

    Ben Edmunds

    812 posts

    Miguel Suárez,

    That should work fine, any errors?  if you do a var_dump($_POST); what do you get?

  • #1248 / Jul 17, 2012 1:42pm

    Miguel Suárez

    6 posts

    Mmmm sorry my bad, wrong variable name, using “userPass1” instead of “password”.

    Funny how right after I post I find the solution.

    Have to say, nice Auth system you have here, been using it for a day and its pretty complete!

    Thanks for sharing

  • #1249 / Jul 17, 2012 6:09pm

    rip_pit

    88 posts

    rip_pit,

    Please send a pull request for any additional translations that are needed.  Thanks!

    As you asked, i tried to submit the first part for untranslated strings i found but i’m not sure if i did it in the right way :

    I already had a fork created : from this fork, i browsed the ion_auth files and edited the ones required.

    Is that the right way ? is this helpfull to you ? Hope i’m wrong another time with using GHub haaha

    Fork url: http://github.com/rotinpain/CodeIgniter-Ion-Auth/
    Edited Files list
    . auth controller: i replaced english only strings with reference to lang file
    . language / english / ion_auth_lang.php : added the strings translations
    . language / french / ion_auth_lang.php ! added the strings translations

  • #1250 / Jul 18, 2012 9:33am

    joeizang

    59 posts

    Mr. Ben Edmunds,

    God bless you for this library. It is just genius. I only would like to ask I saw a profile() function in the model somewhere in the past versions - do we still get something like that later? And I don’t get the documentation of the trigger_event(). Can anyone shed light on some of these undocumented features of this awesome library?

  • #1251 / Jul 18, 2012 1:02pm

    Miguel Suárez

    6 posts

    Weird, I cant get the current logged in user data:

    if($this->ion_auth->logged_in())
    {
     $data['user'] = $this->ion_auth->user()->row();    
     var_dump($data['user']);
    }

    Prints out:

    array(0) { }

    Any idea?

    [EDIT]

    Ok I fixed with this:

    if($this->ion_auth->logged_in())
    {
     $data['user'] = $this->ion_auth->user($this->session->userdata('user_id'))->row();    
     var_dump($data['user']);
    }

    Or change the line 1155 in the file ion_auth_model.php to:

    //if no id was passed use the current users id
    if($id == NULL)
     $id = $this->session->userdata('user_id');

    Maybe just uncommenting the line will help, but Ive no idea what that line does.

    [EDIT2]
    OK, aparently just uncommenting that line works, why was it commented out?

  • #1252 / Jul 18, 2012 7:06pm

    Ben Edmunds

    812 posts

    Hey Miguel Suárez,

    It’s not commented out in the latest code, maybe you have an older version?

  • #1253 / Jul 18, 2012 8:47pm

    Miguel Suárez

    6 posts

    I probably don’t have the latest version, but I downloaded it yesterday, maybe some one removed the comment some time after I downloaded It.

  • #1254 / Jul 19, 2012 7:51pm

    rei

    67 posts

    Hi, do I need to escape user inputted data when using the built in functions of ion auth? Like when creating a new user using ion_auth->register() ? or It is auto escaped by the ion auth functions? And one more thing, how can I create new user groups? Because the default is just admin and member, can I add new user groups like contributor and subscriber? If yes, how can I do that? Thanks again in advance 😊

  • #1255 / Jul 19, 2012 8:50pm

    rei

    67 posts

    Hi, I want to report something. I encountered a problem in displaying the change password success messages after forgot pasword. The flash_data is being cleared by the $this->ion_auth->logout() method.

    Here is the code after successfuly changing password after forgot password:

    if ($change)
         { //if the password was successfully changed
          $this->session->set_flashdata('message', $this->ion_auth->messages());
          
          $this->session->set_flashdata('try', 'password changed!');
          
          $this->session->set_userdata('some_name', 'some_value');
          
          
          $this->logout();
         }
    
    
    
    
    
    
    function logout()
     {
      $this->data['title'] = "Logout";
      
      //log the user out
      $logout = $this->ion_auth->logout();
    
      //redirect them back to the page they came from
      redirect('login', 'refresh');
     }
    
    
    
    
    Here is the problem in the logout() in Ion Auth
    
     /**
      * logout
      *
      * @return void
      * @author Mathew
      **/
     public function logout()
     { 
      //Recreate the session
      $this->session->sess_destroy();   // this is destroying all session data thats why the success message is being cleared. 
     
     }

     

     

     

  • #1256 / Jul 23, 2012 4:47am

    ZaLiTHkA

    29 posts

    I’ve got a problem adding users using the form found in ‘/auth/create_user.php’, when I try add a user, I get an error page with the following message:

    Error Number:

    Implicit conversion from data type varchar to varbinary is not allowed. Use the CONVERT function to run this query.

    INSERT INTO AESW_users (first_name, last_name, company, username, password, email, ip_address, created_on, last_login, active) VALUES (‘First’, ‘Last’, ‘Company’, ‘first last’, ‘91d926115b5d238dd12fd83e3cb7d8b7014e34ca’, ‘[email protected]’, ‘’, 1343032245, 1343032245, 1)

    Filename: C:\EasyPHP\www\AESPortal_CI\system\database\DB_driver.php

    Line Number: 330

    Looking at the values in the query, it’s trying to write an empty string to the [ip_address] field.. I’m not too worried about logging IP addresses though, this will only be used on a company WAN.

    I’m using EasyPHP 12 in my dev environment, with PHP 5.3.9 using a DB on SQL2005. The provided SQL scripts didn’t work for me, so I manually created the tables in Management Studio, as per the ‘ion_auth.mssql.sql’ file in the download, I setup [ip_address] with a data type of varbinary(16).

    Any suggestions here?

  • #1257 / Jul 23, 2012 5:12pm

    rip_pit

    88 posts

    Looking at the values in the query, it’s trying to write an empty string to the [ip_address] field.. I’m not too worried about logging IP addresses though, this will only be used on a company WAN.
    ...
    I setup [ip_address] with a data type of varbinary(16).

    i encounter a problem too with ion auth login ips on my local server but i can’t really remember how i solved it

    What’s says your logs ? CI logs / php / apache / mysql logs ?

    i remember of inet_pton function but i’m not sure it was directly related

  • #1258 / Jul 24, 2012 2:46am

    ZaLiTHkA

    29 posts

    What’s says your logs ? CI logs / php / apache / mysql logs ?

    The CI forum won’t let me post the relative lines from my log (I get message about not being able to post certain content), so I dropped the lines in Pastebin for now.

    There’s nothing in the Apache log (which makes sense, this looks like a PHP issue). I’m using MSSQL not MySQL, watching SQL Profiler while I try create a user, SQL itself doesn’t ever get to the point of trying to run any insert statement. I do see a line with a SELECT from the users table looking for entries with the same username as the user I’m trying to create, but other than that, I don’t see anything else helpful there.

  • #1259 / Jul 26, 2012 8:26pm

    rip_pit

    88 posts

    I never used mssql you should submit an issue ticket on the github project page (https://github.com/benedmunds/CodeIgniter-Ion-Auth/issues) including the pastebin url but i’m not sure if it’s related to CI itself or to Ion_auth
    Sorry i will be a little help for you problem :’(

  • #1260 / Jul 27, 2012 2:22pm

    sevengraff

    5 posts

    Yeah whats the story with how Ion_Auth stores IP addresses? I was surprised that it seem to store them as raw number instead of a string that I can more easily search/deal with.

    Also, does Ion_Auth generate the documentation at http://benedmunds.com/ion_auth/ with a tool or is it just typed out as a HTML document? I’d like to work on the documentation but I’m not sure if I should embed it in the code or edit the docs directly.

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

ExpressionEngine News!

#eecms, #events, #releases