Part of the EllisLab Network
   
21 of 36
21
FreakAuth_light authentication library/admin application released!
Posted: 06 March 2007 02:12 AM   [ Ignore ]   [ # 301 ]  
Summer Student
Total Posts:  28
Joined  11-23-2006
danfreak - 02 March 2007 03:08 AM
garri - 02 March 2007 01:01 AM

Good Day!

First of all FAL is really promising!

I’m currently developing on a localhost my box has no capability to send email for activation. so i used the add user function in the admin panel but it seems that it is not working?

I guess you are running PHP4. If Yesyou have 2 solutions to sort out your problem:

a) turn custom user_profile OFF in the application/config/freakauth_light.php

b) have a look to what the gang suggested in this forum @page 18

I hope this helps!

PS: to enable mailing in your localhost on Wondows open your php.ini file and find the below stuff and change it to suit your internet provider smtp config

[mail function]
; For Win32 only.
SMTP = smtp.tiscali.it
smtp_port
= 25

Im not running on PHP4 but the solution worked, I’m running PHP5 Ubuntu 6.10

Profile
 
 
Posted: 06 March 2007 02:21 AM   [ Ignore ]   [ # 302 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  514
Joined  12-05-2006
garri - 06 March 2007 02:12 AM

PS: to enable mailing in your localhost on Wondows open your php.ini file and find the below stuff and change it to suit your internet provider smtp config

[mail function]
; For Win32 only.
SMTP = smtp.tiscali.it
smtp_port
= 25

Im not running on PHP4 but the solution worked, I’m running PHP5 Ubuntu 6.10

Cool!

do you mean the solution for php.ini above?

tongue laugh

 Signature 

FreakAuth_light: pluggable & extendable authentication library that works on CI 1.5.X

CI SWIFT MAILER: 44% less memory than PHPMailer at double speed

Using Zend Framework components in Code Igniter

Profile
 
 
Posted: 07 March 2007 04:01 AM   [ Ignore ]   [ # 303 ]  
Summer Student
Total Posts:  28
Joined  11-23-2006
oldcity - 28 February 2007 12:34 PM

I think I’ve got it now…

(in \system\application\libraries\Freakauth_light.php)

replace all instances

$this->CI->load->model('Userprofile', 'userprofile');

with

$this->CI->load->model('Userprofile');

then

replace all instances

>CI->userprofile

with

>CI->Userprofile

*Notice capital U in Userprofile

 

Then, put ztinger’s code in auth.php and admin/admins.php

For example: line 46 or so in admin/admins.php

$this->lang->load('freakauth');
        
$this->load->model('FreakAuth_light/usermodel', 'usermodel');
         
$this->load->model('Userprofile');  // <--- Add this line
        
$this->load->library('validation');

nope, i mean this. Sorry Hehehehe

Profile
 
 
Posted: 07 March 2007 07:22 AM   [ Ignore ]   [ # 304 ]  
Summer Student
Total Posts:  17
Joined  11-14-2006

hi i found it useful to return the actual userid
i.e if you write a blog and you want to add the author ID
so i patched system/application/libraries/Freakauth_light.php
and added the following method:

/**
     * Returns the currently logged in user's id
     * Returns an empty string if no user is logged in
     * uses function isValidUser()
     * and Class db_session method "userdata".
     *
     * @return id int of currently logged in user
     * @return empty string if user not logged in
     */
    
function getUserID()
    
{
        
if ($this->CI->config->item('FAL') && $this->CI->db_session && ($this->isValidUser() OR $this->isAdmin()))
            
            
// returns username string of currently logged in user
            
return $this->CI->db_session->userdata('id');
        
        
// returns empty string if user not logged in
        
return '';
    
}

also i added to so i patched system/application/helpers/freakauth_light_helper.php

// ------------------------------------------------------------------------
//
// Returns the currently logged on user's id.
// Returns an empty string if no user is logged in.
//
function getUserID()
{
    $obj
=& get_instance();
    return
$obj->freakauth_light->getUserID();
}

so i can use it for a blog entry in my blog model:

function insertEntry($data){
        $ok
=false;
        if(
isarray($data)){
            
if(count($data)>1) $ok=true;
        
}
        $id
="x";
        if(
$ok){
            $d
= date("Y-m-d H:i:s");
            
$data["date_added"] = $d;
            
$data["date_updated"] = $d;
            
$data["author_id"]=getUserID();
            
$this->db->insert('blog_entries', $this);
        
}
    }
Profile
 
 
Posted: 07 March 2007 07:59 AM   [ Ignore ]   [ # 305 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  514
Joined  12-05-2006

@alexpetri
Cheers for the contribution! Not essential but usefull!

Just wanted to drop a line to tell that next release will be delayed by 1 week due to a work I have to finish.

Dan

 Signature 

FreakAuth_light: pluggable & extendable authentication library that works on CI 1.5.X

CI SWIFT MAILER: 44% less memory than PHPMailer at double speed

Using Zend Framework components in Code Igniter

Profile
 
 
Posted: 10 March 2007 05:17 AM   [ Ignore ]   [ # 306 ]  
Summer Student
Total Posts:  1
Joined  01-08-2003

Is there any quick and easy way to allow the user to toggle whether he wants FreakAuth_light to remember him (set the cookie) when logging in?

Like a checkbox on the login page titled: “Remember me on this computer”

Profile
 
 
Posted: 11 March 2007 04:45 PM   [ Ignore ]   [ # 307 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  514
Joined  12-05-2006
matic - 10 March 2007 05:17 AM

Is there any quick and easy way to allow the user to toggle whether he wants FreakAuth_light to remember him (set the cookie) when logging in?

Like a checkbox on the login page titled: “Remember me on this computer”

This feature is not included yet in the default package.

It should be cinsidered in next releases.

If in the meanwhile you guys implement it, please let me know.

Dan

 Signature 

FreakAuth_light: pluggable & extendable authentication library that works on CI 1.5.X

CI SWIFT MAILER: 44% less memory than PHPMailer at double speed

Using Zend Framework components in Code Igniter

Profile
 
 
Posted: 11 March 2007 05:55 PM   [ Ignore ]   [ # 308 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  208
Joined  06-12-2006
danfreak - 11 March 2007 04:45 PM
matic - 10 March 2007 05:17 AM

Is there any quick and easy way to allow the user to toggle whether he wants FreakAuth_light to remember him (set the cookie) when logging in?

Like a checkbox on the login page titled: “Remember me on this computer”

This feature is not included yet in the default package.

It should be cinsidered in next releases.

If in the meanwhile you guys implement it, please let me know.

Dan

I need it too. Anyways, how should this be done? By setting the duration of the session for month? If so, seems rather feasible.

Profile
 
 
Posted: 11 March 2007 06:22 PM   [ Ignore ]   [ # 309 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  514
Joined  12-05-2006

Yes it’s rather feasible.

You should add a checkbox in your login view named remember_me

The peseudo code should look something like:

Function getLoginForm() in FreakAuth_light.php (library)

//....

$value[remember_me]=$this->CI->input->post('remember_me', 0);

//let's check if the checkbox remember me has been checked
if ($value[remember_me]!=0)
{
    
//if it has been checked, set the expiry date of the cockie now+(3600*24*30)
   
$this->CI->config->set_item('sess_expiration', now()+(3600*24*30);            //<--used in DB_session to set cookie expiration
}

You should try it out yourself for now: didn’t test it

[EDITED]
Alternatively you should send a second cookie, containing securely encripted username&pass;, and hack the library in order to check for this cookie first in the login() method

Remember that FAL sends just a cookie, with no username or password in it.

PS: cookies are sent/updated by the DB_session library

 Signature 

FreakAuth_light: pluggable & extendable authentication library that works on CI 1.5.X

CI SWIFT MAILER: 44% less memory than PHPMailer at double speed

Using Zend Framework components in Code Igniter

Profile
 
 
Posted: 12 March 2007 10:00 PM   [ Ignore ]   [ # 310 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  192
Joined  02-25-2007

Question:

Is there a way for users who are not admins to be able to access their own profiles?

Profile
 
 
Posted: 13 March 2007 03:01 AM   [ Ignore ]   [ # 311 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  514
Joined  12-05-2006
codelearn - 12 March 2007 10:00 PM

Question:

Is there a way for users who are not admins to be able to access their own profiles?

Yes, but unluckily you should code a controller yourself. I’m working on it for a project today, so I’ll post my controller as soon as I’ll finish it.

In the meanwhile have a look at the controller admin/users.php.

Remember that registered users can change everything but their username, that must be unique.

I give you a pseudo code to start if you are impatient:

<?php
class Myaccount extends Controller
{
    
function Myaccount()
    
{
        parent
::Controller();
        
        
//let's limit access to registered users only
        
$this->freakauth_light->check();
        
    
}
    
    
// --------------------------------------------------------------------
    /**
     * Display account info only to logged in user&to the owner of the acount
     *
     */
    
function index()
    
{
        
//check if a number in the uri
        
$_user_id= $this->uri->segment(2);
        
//if number and number==userdata['id']
        
if ($_user_id==$this->db->userdata('id'))
        
{
            
//display myaccount
            
$this->_display_account($_user_id);
        
}
        
else
        
{
            
//tell the user that he should login first
            
$this->load->view('you_must_login_first');
        
}
    }
    
    
// --------------------------------------------------------------------
    /**
     * Display account info only to logged in user&to the owner of the acount
     *
     */
    
function _display_account()
    
{
        
    }
    
    
// --------------------------------------------------------------------
    /**
     * allows the user to edit his account info
     *
     */
    
function edit()
    
{
        
//check if a number in the uri
        
$_user_id= $this->uri->segment(3);
        
//if number and number==userdata['id']
        
if ($_user_id==$this->db->userdata('id'))
        
{
            
//display myaccount
            
$this->_edit_account($_user_id);
        
}
        
else
        
{
            
//tell the user that he should login first
            
$this->load->view('you_must_login_first');
        
}
    }
    
    
// --------------------------------------------------------------------
    /**
     * allows the owner of the account to edit his infos
     *
     */
    
function _edit_account()
    
{
    }    
    
}
?>
 Signature 

FreakAuth_light: pluggable & extendable authentication library that works on CI 1.5.X

CI SWIFT MAILER: 44% less memory than PHPMailer at double speed

Using Zend Framework components in Code Igniter

Profile
 
 
Posted: 13 March 2007 09:39 AM   [ Ignore ]   [ # 312 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  192
Joined  02-25-2007

Cool! I’ll be standing by!


Thanks!!!

Profile
 
 
Posted: 14 March 2007 01:42 AM   [ Ignore ]   [ # 313 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  277
Joined  02-07-2007

Hey Dan - I have freed up some time and if you would like some help in developing FAL drop me a line at my email address in my profile, as I do not want to put it in the forum for spam bots.

I still have yet to finish my XML config implementation - and my XML config encryption library.

Anywho, give me a holla (15th, 16th I am in Vegas, Nevada - will be at home with my development machine on the night of the 16th).


—Iksander

Profile
 
 
Posted: 14 March 2007 03:32 AM   [ Ignore ]   [ # 314 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  514
Joined  12-05-2006
Iksander - 14 March 2007 01:42 AM

Hey Dan - I have freed up some time and if you would like some help in developing FAL drop me a line at my email address in my profile, as I do not want to put it in the forum for spam bots.

I still have yet to finish my XML config implementation - and my XML config encryption library.

Anywho, give me a holla (15th, 16th I am in Vegas, Nevada - will be at home with my development machine on the night of the 16th).


—Iksander

Ok Iksander!

I’ll send you an e-mail this afternoon with dev plans!

Dan

 Signature 

FreakAuth_light: pluggable & extendable authentication library that works on CI 1.5.X

CI SWIFT MAILER: 44% less memory than PHPMailer at double speed

Using Zend Framework components in Code Igniter

Profile
 
 
Posted: 14 March 2007 09:03 AM   [ Ignore ]   [ # 315 ]  
Summer Student
Avatar
Total Posts:  21
Joined  12-01-2006

I’am just tryin’ and I get this error “Fatal error: Cannot redeclare class freakauth_light in /home/pxlusion/web/www/system/application/libraries/Freakauth_light.php on line 67” why ? I only done what you’ve said in the install-instruction ( that’s maybe a stupid question )...

Profile
 
 
   
21 of 36
21
 
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: 77568 Total Logged-in Users: 18
Total Topics: 101557 Total Anonymous Users: 2
Total Replies: 544401 Total Guests: 206
Total Posts: 645958    
Members ( View Memberlist )
Newest Members:  ColeJLinskitnealsemperjrawhallshiusbozzlynobluffkatiejameshsmith101dddougal