Part of the EllisLab Network
   
23 of 36
23
FreakAuth_light authentication library/admin application released!
Posted: 21 March 2007 06:14 PM   [ Ignore ]   [ # 331 ]  
Grad Student
Avatar
Rank
Total Posts:  46
Joined  03-14-2006

hi there,

I wanted to say thank you for making this extension! I’m quite new to it, so i hope this isn’t a very silly question. I’m having some problems that i think might have something to do with sessions. I’ve installed it and according the installer, everything went okay. I can login okay, but as soon as i go to another page, i’m no longer logged in (for example, i login and then go to change password and it no longer says i am logged in; or i login as the admin, and then click on one of the admin menu options and it sends me back to the login).

I had setup sessions on code igniter before and they worked okay, and i checked ci_sessions in the database and it looks like all the session are being inserted there okay.

I tried changing the cookie autologin settings in the freakauth_light config file but that didn’t help.

I checked the forum for a similar problem, but only found one where someone had shut off cookies on their browser and my cookies are on so it shouldn’t be that.

I’m using php4 and the latest beta (1.0.2) of freakauth.

Also hopefully it’s okay, but as i was looking through the forum for some answers to my questions, i recorded some posts that seemed to answer my questions and thought it might be useful to put them up somewhere so i added some links in the codeigniter wiki under the heading ‘FAQ (some links to forum posts on specific problems)’. So hopefully that’s not the wrong place to put something like that. If it is i can remove it.

Okay but i really hope it’s not too silly a question, and i hope someone could point me in the right direction, it would be very much appreciated! Thanks again!

andrew.

Profile
 
 
Posted: 21 March 2007 11:42 PM   [ Ignore ]   [ # 332 ]  
Summer Student
Total Posts:  24
Joined  03-21-2007

Hi Guys

I am having a little trouble with the email from the register page. I ma using CI om a win box and receive this message when i try to register a user

A PHP Error was encountered

Severity: Warning

Message: mail(): SMTP server response: 550 Sender address is invalid

Filename: libraries/Email.php

Line Number: 1232

Any Ideas Anyone?

Profile
 
 
Posted: 22 March 2007 01:52 AM   [ Ignore ]   [ # 333 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  493
Joined  02-21-2007
richman - 21 March 2007 11:42 PM

Hi Guys

I am having a little trouble with the email from the register page. I ma using CI om a win box and receive this message when i try to register a user

A PHP Error was encountered

Severity: Warning

Message: mail(): SMTP server response: 550 Sender address is invalid

Filename: libraries/Email.php

Line Number: 1232

Any Ideas Anyone?

Hi, you could try one of those:
- enable mails from your windows box (see this post from Dan)
- write a switch to deactivate mails (see this post from stevepaperjam)
- do some tests without mails, adding a user in the admin area.

Hope this helps…

Profile
 
 
Posted: 22 March 2007 02:47 AM   [ Ignore ]   [ # 334 ]  
Summer Student
Total Posts:  24
Joined  03-21-2007

hi grahack

I have read the posts and I have sent email form localhost before however my problem seems to lie with this line

$tobj->email->from($this->CI->config->item(‘FAL_user_support’), $this->CI->config->item(‘FAL_website_name’).’ ‘.$this->CI->config->item(‘FAL_email_from’));

This is in the _sendEmail function line 921 libaries\Freakauth_light.php

Basically I can fix the problem with replacing the line with

$tobj->email->from(‘richard@mysite.com’);

But I do not understand why and what the parameters for the $tobj are ?

Thanks Richard

Profile
 
 
Posted: 22 March 2007 03:59 AM   [ Ignore ]   [ # 335 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  512
Joined  12-05-2006
richman - 22 March 2007 02:47 AM

hi grahack

I have read the posts and I have sent email form localhost before however my problem seems to lie with this line

$tobj->email->from($this->CI->config->item(‘FAL_user_support’), $this->CI->config->item(‘FAL_website_name’).’ ‘.$this->CI->config->item(‘FAL_email_from’));

This is in the _sendEmail function line 921 libaries\Freakauth_light.php

Basically I can fix the problem with replacing the line with

$tobj->email->from(‘richard@mysite.com’);

But I do not understand why and what the parameters for the $tobj are ?

Thanks Richard

Hey richman,
did you set the right config in application/config/freakauth_light.php?
Check you have this set properly:

//...
$config['FAL_website_name']    = "Your_website_name";

$config['FAL_user_support'] = 'you@your_email.com';
//...
$config['FAL_email_from'] = 'webmaster';

According to the setting above this will basically send an e-mail from:
—> address: you@your_email.com
—>displaying: Your_website_name webmaster (in the ‘from’)

In this case (with the above settings) the line

$tobj->email->from($this->CI->config->item(’FAL_user_support’), $this->CI->config->item(’FAL_website_name’).’ ‘.$this->CI->config->item(’FAL_email_from’));

is equivalent to

$tobj->email->from('you@your_email.com', 'Your_website_name webmaster');

the papameters in $tobj->email->from are explained here in the user-guide:  Email Class

$this->load->library('email');

$this->email->from('your@your-site.com', 'Your Name');
$this->email->to('someone@some-site.com');
$this->email->cc('another@another-site.com');
$this->email->bcc('them@their-site.com');

$this->email->subject('Email Test');
$this->email->message('Testing the email class.');

$this->email->send();

echo
$this->email->print_debugger();

For sending e-mails FAL uses the native Code Igniter Email Class then refer to it for problems.

 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: 22 March 2007 04:06 AM   [ Ignore ]   [ # 336 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  512
Joined  12-05-2006
edwardmolasses - 21 March 2007 06:14 PM

hi there,

I wanted to say thank you for making this extension! I’m quite new to it, so i hope this isn’t a very silly question. I’m having some problems that i think might have something to do with sessions. I’ve installed it and according the installer, everything went okay. I can login okay, but as soon as i go to another page, i’m no longer logged in (for example, i login and then go to change password and it no longer says i am logged in; or i login as the admin, and then click on one of the admin menu options and it sends me back to the login).

andrew.

Hey Andrew, your welcome!
cheers for yous “help summary” in the wiki grin

Well yours is a strange issue!

Well ou said you have cookies enabled, and that your session is written ok in DB.

did you change any setting in the application/config/config.php ?

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: 22 March 2007 07:08 AM   [ Ignore ]   [ # 337 ]  
Summer Student
Avatar
Total Posts:  21
Joined  12-01-2006

Okay ! it finally works, indeed I had a controller named “admin” which was bypassing the folder admin when I tried to login as an admin user. Now I have some questions, first one, I’m working on a little project ( flash development community website ) and I need a fast registration system ( almost unsecured of course… ) so is there a way to delete the activation system properly or I need to remake partly the library ? ( sorry for my english ) I wanted also to make a fast admin system, I saw that there is a method ( is valid user ) , but how can I custom a view ? ... actually this method can be used in a controller like if valid user “do this” else “do that” but is there a way to act in a view instead of make a custom view for an admin and one other for the basic user… For an exemple, in a view file, is that possible ?

if admin
-> show the article, the delete function, the edit function
else
->
show the article


I am sorry it’ll appear easy for you I think, that’s all, thanks in advance !

Profile
 
 
Posted: 22 March 2007 07:31 AM   [ Ignore ]   [ # 338 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  512
Joined  12-05-2006

Hey m0oton,

I’m happy you managed!

Ok, it seems you are speaking about links to edit, delete functions!

Then I suppose you have a controller with a method that displays the article, right?

The most simple way is to put this in your view (you must customize it according to your links)

<?php
if (isAdmin())
{
    $admin_menu
= anchor('edit/'.$article_id, 'edit')."|".anchor('delete/'.$article_id, 'delete');
        echo
$admin_menu;
}
?>

You could control this also in your controller as follows

...

if (
isAdmin())
{
        $article[
'id']=$id;
    
$data['article_menu'] = $this->load->view('path_to_your_menu_view/article_admin_menu', $article, TRUE);
}

...

You must put an article_admin_menu.php file in your views, and in the view that displays your article write:

...
<?=  isset($article_menu) ? $article_menu: '';?>
...

 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: 22 March 2007 07:35 AM   [ Ignore ]   [ # 339 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  493
Joined  02-21-2007
m0oton - 22 March 2007 07:08 AM

is there a way to delete the activation system properly or I need to remake partly the library ?

I wanted also to make a fast admin system, I saw that there is a method ( is valid user ) , but how can I custom a view ? ... actually this method can be used in a controller like if valid user “do this” else “do that” but is there a way to act in a view instead of make a custom view for an admin and one other for the basic user… For an exemple, in a view file, is that possible ?

if admin
-> show the article, the delete function, the edit function
else
->
show the article


I am sorry it’ll appear easy for you I think, that’s all, thanks in advance !

About activation, I read this not so long ago, you could try and tell us if it suits your needs.

About the check in the views, you have helper functions (be sure to load them).

<?php if (isAdmin()) : ?>
     
<li><?=anchor('admin', 'admin page')?></li>
<?php endif; ?>

Profile
 
 
Posted: 22 March 2007 10:17 AM   [ Ignore ]   [ # 340 ]  
Summer Student
Avatar
Total Posts:  1
Joined  03-22-2007
danfreak - 07 March 2007 07:59 AM

@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

Any update on the next release? Not trying to be pushy, I just don’t want to jump in if the water is cold especially if it will heat back up in a day of two. I hate it when I get my core needlessly shriveled. smile

Profile
 
 
Posted: 22 March 2007 11:40 AM   [ Ignore ]   [ # 341 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  181
Joined  02-25-2007

Danfreak,

How would I let levels 3 and 4 to access the admin console upon login?

Profile
 
 
Posted: 22 March 2007 11:55 AM   [ Ignore ]   [ # 342 ]  
Summer Student
Avatar
Total Posts:  21
Joined  12-01-2006

Thanks dan and mind, that was all I just needed =)

Profile
 
 
Posted: 22 March 2007 12:18 PM   [ Ignore ]   [ # 343 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  512
Joined  12-05-2006
codelearn - 22 March 2007 11:40 AM

Danfreak,

How would I let levels 3 and 4 to access the admin console upon login?

Quoting the comment inside the library to the method check()
/**
    * Method used to restrict acess to controllers or methods of controllers to the specified category of users
    * it requires 2 optional parameters
    * The first parameterspecifies the user group i.e. (‘admin’)
    * The second parameter specifies whether the area is reserved ONLY to that group (true) or if it is accessible by groups higher in the hierarchy
    *
    * example usage in a controller
    * /

$this->freakauth_light->check()  // <-- this restricts acess to registered users and user-groups higher in the hierarchy (i.e. admin, superadmin)
     
$this->freakauth_light->check('admin')  //  <-- this restricts acess to 'admin' and user-groups higher in the hierarchy (i.e. superadmin)
     
$this->freakauth_light->check('admin', true)  //  <--this restricts acess to 'admin' ONLY
      
     /* @param string (to specify the role to whom the area is restricted to) $lock_to_role
     * @param boolean (true/false) $only
     */

You can alternatively use the helper belongsToGroup()

**
  * Function used to check if a logged in members belongs to the custom role (group) specified in the first parameter
    * it requires 2 optional parameters
    * The first parameter specifies the user groups as a comma separated string(NB: just comma separated WITHOUT SPACES->‘user,admin’<—RIGHT ‘user, admin’<—WRONG)
    * The second parameter specifies whether we want to check to the specified groups ONLY or for AT LEAST those group membership in the hierarchy
    * (returns true also if the logged user belongs to a group higher in the hierarchy)
    *
    * example usage in a view to echo something depending on it’s role (it can be a menu option for example)
    * /

<?=belongsToGroup() ? $display-this : $display_that;?> //  <-- displays-this if the visitor is logged in and he is AT LEAST an user, $display_that otherwise
     
<?=belongsToGroup('user,editor')? $display-this : $display_that;?>  //  <--displays-this if the visitor is logged in and he is AT LEAST an user or an editor (therefore it displays-this also if he belongs to user-groups higher in the hierarchy (i.e. superadmin), $display_that otherwise
     
<?=belongsToGroup('admin', true)? $display-this : $display_that;?>  //  <--displays-this if the visitor is logged in and is an 'admin' ONLY, $display_that otherwise

You must use this methods in:
=> your constructor if you wanna secure the entire controller (no matter the method)
=> in a specific method of your controller if you wanna secure just that

Hope this helps!

 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: 22 March 2007 12:27 PM   [ Ignore ]   [ # 344 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  512
Joined  12-05-2006
MiNdSpaZz - 22 March 2007 10:17 AM
danfreak - 07 March 2007 07:59 AM

@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

Any update on the next release? Not trying to be pushy, I just don’t want to jump in if the water is cold especially if it will heat back up in a day of two. I hate it when I get my core needlessly shriveled. smile

Well I think that 1 or 2 days are not enough unluckily for the next release.

Due to some delays don’t expect it before 7/10 days.

 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: 22 March 2007 01:19 PM   [ Ignore ]   [ # 345 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  181
Joined  02-25-2007

Thanks Dan, figured it out. Had to add a case in the Auth controller.

wink

Profile
 
 
   
23 of 36
23
 
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: 66432 Total Logged-in Users: 32
Total Topics: 84798 Total Anonymous Users: 1
Total Replies: 455094 Total Guests: 221
Total Posts: 539892    
Members ( View Memberlist )
Newest Members:  GlennJHurlyBurlyDylan1978X_franbaguasllogocsaturkeyPeter BryanttherendStudioGeorgiaJ