Part of the EllisLab Network
   
26 of 27
26
UserAuth Mini-App
Posted: 29 November 2007 12:18 PM   [ Ignore ]   [ # 376 ]  
Lab Assistant
RankRank
Total Posts:  270
Joined  08-26-2006

@AofC,

Here is a patch, could I ask You to test it more thoroughly, since I am very taken with a project :

Edit :
1. use the link further down for the patch
2. The bug is fixed with the new version, aslo see further down

What I’ve done :

1. Returned to CI’s Session library, Native Session bugs on my machine under Apache 2 / PHP 5.2.
2. Extended the CI’s session class with Flash var functionality
3. Changed the Userauth library
  - to function with both session libraries
  - added a additional RememberMe check before logging out a user

If You find no bugs, I’ll change the online demo.

Thomas

Profile
 
 
Posted: 29 November 2007 05:02 PM   [ Ignore ]   [ # 377 ]  
Summer Student
Total Posts:  28
Joined  09-27-2006

tomcode,
I tested the remember_me check you added. It works now.
Unfortunately, I’m not set up to test the other changes as I’m using only some parts of those libraries.

Profile
 
 
Posted: 29 November 2007 06:29 PM   [ Ignore ]   [ # 378 ]  
Summer Student
Total Posts:  28
Joined  09-27-2006

I noticed that the remember_me cookie is never expired.
So, I modified the checkRememberMe method in the remember_me.php model to this:

function checkRememberMe ()
    
{
        
//input->cookie returns FALSE if item does not exist
        
$userhash = $this->input->cookie('lool_userhash', TRUE);
        
        
$random_string = $this->input->cookie('lool_randomstring', TRUE);

        if (isset(
$userhash) && isset($random_string) && $userhash != false && $random_string != false) {

            log_message
('debug','Has Remember Me Cookie');
            
// test if mini-app db schema installed

            
if ( ! $this->valid_db() ) { return FALSE; }



            $this
->db->where ('usernamehash', $userhash);

            
$this->db->where ('random_string', $random_string);
            
                 
$result = $this->db->get(REMEMBER_ME_TBL);



            if (
$result != FALSE && $result->num_rows() > 0) {

                $result
= $result->row();
                
                
$expire_time = time() - $this->obj->config->item('remember_me_life');
    
                if (
$result->origin_time <=  $expire_time )
                
{
                    $this
->removeRememberMe();
                    return
FALSE;
                
}
                
else
                
{
                    
return $result->username;
                
}

            }
else { return FALSE; }



        }
else { return FALSE; }

    }

Constant REMEMBER_ME_TBL is whatever the remember_me table is.
Hope this helps.

Profile
 
 
Posted: 30 November 2007 09:51 AM   [ Ignore ]   [ # 379 ]  
Lab Assistant
RankRank
Total Posts:  270
Joined  08-26-2006

I have put the version 0.9.2t6 online with the fix for the RememberMe bug.

Additionaly I made a patch for Apache 2 / PHP 5. It replaces Native Session with CI’s session.

@AofC: Indeed this helped me. Thanks.

Profile
 
 
Posted: 15 December 2007 06:21 PM   [ Ignore ]   [ # 380 ]  
Grad Student
Avatar
Rank
Total Posts:  54
Joined  08-27-2006

Hello tomcode,

Noticed in the UserAuth changelog that the language files are now located in the application directory.

Out of curiosity… what was the purpose for moving them?

Thanks!

-JamesD

 Signature 

Find out how you can get paid every time your website is seen…

Profile
 
 
Posted: 15 December 2007 07:19 PM   [ Ignore ]   [ # 381 ]  
Lab Assistant
RankRank
Total Posts:  270
Joined  08-26-2006

Hi JamesD,

I like to have all stuff together under one directory.
I don’t like to touch the system folder.
Easier to maintain: on tomcode.com and on my local dev machine I have the system outside of the web root, while each app sticks together with it’s index file.

Profile
 
 
Posted: 15 December 2007 07:30 PM   [ Ignore ]   [ # 382 ]  
Grad Student
Avatar
Rank
Total Posts:  54
Joined  08-27-2006
tomcode - 15 December 2007 07:19 PM

Hi JamesD,

I like to have all stuff together under one directory.
I don’t like to touch the system folder.
Easier to maintain: on tomcode.com and on my local dev machine I have the system outside of the web root, while each app sticks together with it’s index file.

Ahhh, gotcha… thanks!  wink

 Signature 

Find out how you can get paid every time your website is seen…

Profile
 
 
Posted: 15 December 2007 08:28 PM   [ Ignore ]   [ # 383 ]  
Grad Student
Avatar
Rank
Total Posts:  54
Joined  08-27-2006

(for what it’s worth)
Oh, and tomcode… thanks for your hardwork contribution with it too. I personally do appreciate it.

 Signature 

Find out how you can get paid every time your website is seen…

Profile
 
 
Posted: 15 December 2007 08:40 PM   [ Ignore ]   [ # 384 ]  
Lab Assistant
RankRank
Total Posts:  270
Joined  08-26-2006

Thanks, man. But credit’s should go in first place to the guys who came with, Craig, Derek and Peccavio.

Profile
 
 
Posted: 15 December 2007 08:54 PM   [ Ignore ]   [ # 385 ]  
Grad Student
Avatar
Rank
Total Posts:  54
Joined  08-27-2006
tomcode - 15 December 2007 08:40 PM

Thanks, man. But credit’s should go in first place to the guys who came with, Craig, Derek and Peccavio.

Yep, agreed… they have been great!

But, I have already accomplished that (moons ago)

IMHO, you have been a good contributor and have helped quite a few here. So, with that being said, I was giving credit where credit is due!  grin

 Signature 

Find out how you can get paid every time your website is seen…

Profile
 
 
Posted: 19 December 2007 03:54 PM   [ Ignore ]   [ # 386 ]  
Grad Student
Avatar
Rank
Total Posts:  54
Joined  08-27-2006

I believe I did run across a bug in regards to Case Sensitive username login.

One can still login using the same username with different upper/lower cases characters, but the privileges are dropped to the lowest group (i.e. ‘guest’ in my case).

For example….
If I have a user with the username of ‘SupermaN’, and that user is indeed in the ‘Admin’ group, that user can still login using ‘superman’... BUT, their privileges are not that of ‘Admin’... only that of ‘guest’.

To fix this I changed 2 lines in system/application/models/user_group_model.php. Both lines identical, just different locations.

The first line is in the function testLogin and the second line is in the function userExists. (line 274 & line 300)

Old line:

$this->db->where('username', $username);

New line:

$this->db->where('username LIKE BINARY', $username);

Adding the “LIKE BINARY” allows CaSe SeNsItIvItY.

Please feel free to let me know if there is a better way to handle this or if there was a specific reason for doing it without case sensitivity.

Hope this helps others, thanks!

-JamesD

 Signature 

Find out how you can get paid every time your website is seen…

Profile
 
 
Posted: 19 December 2007 05:38 PM   [ Ignore ]   [ # 387 ]  
Lab Assistant
RankRank
Total Posts:  270
Joined  08-26-2006

Hi JamesD,

Thanks for the trace down. No, I do not see any special reason for not having case sensitive strings. Still, I’ll have a closer look on it.

I guess Your solution is a good way to handle it.

I’ll need some days to go through it, got a lot of work to be done the next days.

Profile
 
 
Posted: 19 December 2007 06:46 PM   [ Ignore ]   [ # 388 ]  
Grad Student
Avatar
Rank
Total Posts:  54
Joined  08-27-2006
tomcode - 19 December 2007 05:38 PM

Hi JamesD,

Thanks for the trace down. No, I do not see any special reason for not having case sensitive strings. Still, I’ll have a closer look on it.

I guess Your solution is a good way to handle it.

I’ll need some days to go through it, got a lot of work to be done the next days.

No worries, wasn’t sure if it was specific to my situation… just like to help when I can.

Thanks for the confirmation, have a great/safe holidays (if applicable wink).

-JamesD

 Signature 

Find out how you can get paid every time your website is seen…

Profile
 
 
Posted: 19 December 2007 08:29 PM   [ Ignore ]   [ # 389 ]  
Lab Assistant
RankRank
Total Posts:  270
Joined  08-26-2006

Ah, yeah, should find something for the holidays, instead of starring onto the screen.

Profile
 
 
Posted: 29 December 2007 04:44 AM   [ Ignore ]   [ # 390 ]  
Lab Assistant
RankRank
Total Posts:  270
Joined  08-26-2006

Case Sensitivity:

I’ve found some more lines to change. But I’ve another problem: I cannot insert a user ‘aDmin’, I get db error 1062 ‘Duplicata of field ‘aDmin’ for the key 2’.

Apparently the index of the username field is not case senitive. I’ve searched the mysql manual, but I did not find a solution.

Any suggestions ?

Profile
 
 
   
26 of 27
26
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 719, on June 06, 2008 10:16 AM
Total Registered Members: 77556 Total Logged-in Users: 27
Total Topics: 101551 Total Anonymous Users: 4
Total Replies: 544381 Total Guests: 224
Total Posts: 645932    
Members ( View Memberlist )