EllisLab text mark
Advanced Search
2 of 10
2
   
The Authentication Library 1.0.6
Posted: 11 August 2009 12:54 PM   [ Ignore ]   [ # 21 ]   [ Rating: 0 ]
Joined: 2009-07-18
31 posts

I’m using PHP4 on a shared host.  Let me know if there’s anything else you need.

 
Posted: 06 September 2009 05:55 PM   [ Ignore ]   [ # 22 ]   [ Rating: 0 ]
Joined: 2009-04-13
143 posts

What have I done? In the case when my controller extends Application, my variables are not passing from controller (controllers/admin/admin.php) to view (views/auth/header.php)

Please point me to the docs or a relevant post. Otherwise… what might be my problem? Here’s my Admin controller

class Admin extends Application
{
    
function Admin()
    
{
        parent
::Application();
    
}
    
    
function index()
    
{
        
if(logged_in())
        
{
            $headerdata[
'title']='Administrative Control Panel'// note that $title never makes it to the view (undefined variable error)
            
$this->auth->view('admin/dashboard'$headerdata);
        
}
        
else
        
{
            $this
->auth->login(); // how to pass variables through to this thing?
        
}
    } 

I can pass variables just fine from controllers that do not extend Application. But here there are two different use cases.  When the user is already logged in then it does not pass variables.  When the user is not logged in, also I do not know how to pass variables to the view.

something about routes?

Again, I am very familiar with doing this in controllers that do not extend Application. Where should I look next?

thanks

—Sean Loving

 
Posted: 07 September 2009 12:50 AM   [ Ignore ]   [ # 23 ]   [ Rating: 0 ]
Avatar
Joined: 2009-06-19
6267 posts

Hi,

It should be:

$this->auth->view('dashboard'$headerdata); 

Also make sure you configured the root.php file for Auth.

Enjoy
InsiteFX

 Signature 

Ceritfied State of CT Computer Programming Teacher.
Custom Designed Icons, eBook Covers Software Boxes. CD, DVD Etc. New iPhone® Tab Bar Icons and iPhone® Applications Icons.

STOP! Before posting your questions, remember the WWW Golden rule:
What did you try? What did you get? What did you expect to get?

Input -> Controller | Processing -> Model | Output -> View

 
Posted: 07 September 2009 09:38 PM   [ Ignore ]   [ # 24 ]   [ Rating: 0 ]
Joined: 2009-04-13
143 posts

Thanks InsiteFX,

I have solved part of my problem and I thought it might be useful to others who might want to pass variable data to their header view files.

My problem was that I was trying to use the variable data in my auth/header.php view file.

In my regular controllers I usually call three views - header, main, and footer like this…

$this->load->view('header'$headerdata);
$this->load->view($page$maindata);
$this->load->view('footer'$footerdata); 

This way I can send different variable data to each of my three views that generate my page.

However, in my admin controllers things are handled a bit differently. The Auth Library automatically generates three view requests based on making one single call to the libraries/auth/view function like this:

$this->auth->view($page$data); 

which actually generates three separate view requests like this:

$this->auth->view('auth/header');
$this->auth->view('auth/pages/'.$page$data);
$this->auth->view('auth/footer'); 

Notice the generated header and the footer do NOT receive $data.  That was the problem.

Basically, the $this->auth->view function in libraries/Auth.php sends the request to the index.php file in views/auth

So I modified views/auth/index.php so that I can get $data to my auth/header and my auth/footer views like I like.  Here is the new views/auth/index.php file:

<?php
if(isset($data))
{
    $this
->load->view($this->config->item('auth_views_root') . 'header'$data);
    
$this->load->view($this->config->item('auth_views_root') . 'pages/'.$page$data);
    
$this->load->view($this->config->item('auth_views_root') . 'footer'$data);
}
else
{
    $this
->load->view($this->config->item('auth_views_root') . 'header');
    
$this->load->view($this->config->item('auth_views_root') . 'pages/'.$page);
    
$this->load->view($this->config->item('auth_views_root') . 'footer');
}
?> 

—seanloving

 
Posted: 07 September 2009 10:51 PM   [ Ignore ]   [ # 25 ]   [ Rating: 0 ]
Avatar
Joined: 2009-06-19
6267 posts

Hi seanloving,

Yes I am very well informed on the way Auth works, I am using it in Adams Fresh CMS which I am writing a menuing system for, the menuing system is working I am just cleaning it up etc.

 Signature 

Ceritfied State of CT Computer Programming Teacher.
Custom Designed Icons, eBook Covers Software Boxes. CD, DVD Etc. New iPhone® Tab Bar Icons and iPhone® Applications Icons.

STOP! Before posting your questions, remember the WWW Golden rule:
What did you try? What did you get? What did you expect to get?

Input -> Controller | Processing -> Model | Output -> View

 
Posted: 08 September 2009 05:35 AM   [ Ignore ]   [ # 26 ]   [ Rating: 0 ]
Avatar
Joined: 2009-08-28
80 posts

Hello, I have just installed Auth and did not find a forgot password function?
Thanks for your help!
Bernd

 
Posted: 08 September 2009 02:23 PM   [ Ignore ]   [ # 27 ]   [ Rating: 0 ]
Avatar
Joined: 2009-06-19
6267 posts

Hi joytopia.

It’s in the Auth Library in the function register.

Enjoy
InsiteFX

 Signature 

Ceritfied State of CT Computer Programming Teacher.
Custom Designed Icons, eBook Covers Software Boxes. CD, DVD Etc. New iPhone® Tab Bar Icons and iPhone® Applications Icons.

STOP! Before posting your questions, remember the WWW Golden rule:
What did you try? What did you get? What did you expect to get?

Input -> Controller | Processing -> Model | Output -> View

 
Posted: 08 September 2009 02:48 PM   [ Ignore ]   [ # 28 ]   [ Rating: 0 ]
Avatar
Joined: 2009-08-28
80 posts
InsiteFX - 08 September 2009 06:23 PM

It’s in the Auth Library in the function register.

Hi InsiteFX,

thanks for your answer! Do you mean libraries/Auth.php?
Perhaps am I blind, but I read the function register several times and could not find anything like “forgot password”?

Regards, Bernd

 
Posted: 08 September 2009 03:57 PM   [ Ignore ]   [ # 29 ]   [ Rating: 0 ]
Avatar
Joined: 2008-05-04
356 posts

There currently isn’t any forgot password functionality.


Thanks,
Adam

 Signature 

[ Adam Griffiths - Freelance Web Applications Developer ]
[ Follow me on Twitter ]

 
Posted: 08 September 2009 06:15 PM   [ Ignore ]   [ # 30 ]   [ Rating: 0 ]
Avatar
Joined: 2009-08-28
80 posts

Hi Adam,

since I looked for a realy secure forgot password functionality in the web, I learned that it is not a technological but a conceptional problem. Especially with CI it is very easy to send e-mails, make random strings and so on. So I will build my own one.

Thank you for your great work, Adam!

Best regards,
Bernd

 
Posted: 10 September 2009 03:38 AM   [ Ignore ]   [ # 31 ]   [ Rating: 0 ]
Avatar
Joined: 2009-06-19
6267 posts

Sorry Adam,

I was refering to this code in the register method.

if ($this->config['auth_remember'=== TRUE)
{
   $this
->_generate();

So what is this code doing Adam?

For remember me you just need to set it in a cookie right.

Enjoy
InsiteFX

 Signature 

Ceritfied State of CT Computer Programming Teacher.
Custom Designed Icons, eBook Covers Software Boxes. CD, DVD Etc. New iPhone® Tab Bar Icons and iPhone® Applications Icons.

STOP! Before posting your questions, remember the WWW Golden rule:
What did you try? What did you get? What did you expect to get?

Input -> Controller | Processing -> Model | Output -> View

 
Posted: 10 September 2009 04:04 AM   [ Ignore ]   [ # 32 ]   [ Rating: 0 ]
Avatar
Joined: 2008-05-04
356 posts
InsiteFX - 10 September 2009 07:38 AM

Sorry Adam,

I was refering to this code in the register method.

if ($this->config['auth_remember'=== TRUE)
{
   $this
->_generate();

So what is this code doing Adam?

For remember me you just need to set it in a cookie right.

Enjoy
InsiteFX

That’s the remember me function, not a forgot password function. smile


Thanks.

 Signature 

[ Adam Griffiths - Freelance Web Applications Developer ]
[ Follow me on Twitter ]

 
Posted: 10 September 2009 10:54 PM   [ Ignore ]   [ # 33 ]   [ Rating: 0 ]
Avatar
Joined: 2009-06-19
6267 posts

Thanks Adam,

Was a little confuse on that one, but cleared up.

I have all the stuff in my old system I’ll see if I can get it converted over.

Oh and are you making any progress on the page sections?

I have the menuing system almost finished, just debugging it and clean up.

Enjoy
InsiteFX

 Signature 

Ceritfied State of CT Computer Programming Teacher.
Custom Designed Icons, eBook Covers Software Boxes. CD, DVD Etc. New iPhone® Tab Bar Icons and iPhone® Applications Icons.

STOP! Before posting your questions, remember the WWW Golden rule:
What did you try? What did you get? What did you expect to get?

Input -> Controller | Processing -> Model | Output -> View

 
Posted: 12 September 2009 01:06 AM   [ Ignore ]   [ # 34 ]   [ Rating: 0 ]
Avatar
Joined: 2008-08-29
307 posts

A few questions after using the Auth library for a bit…

How does the auth library pass information to the view?

If I have the following controller (note the ‘pagetitle’):

class Pages extends Application
{
    
    
function Pages()
    
{
        parent
::Application();
                
        
$this->auth->restrict('admin'); 
        
$this->load->model($this->models."pagesmodel"'pages');
        
        
$data['pagetitle''Page Management';
    
}
    
function manage(){
        $data[
'pages'$this->pages->get_all_pages(); // Grab an array of all pages from the database
        
        
$this->auth->view('pages/manage');
    
}

My view (manage.php) will display an array of pages (i have just var_dump($data) in manage.php)

What I don’t understand is why $data[‘pagetitle’] = ‘Page Management’; does not come through?

However, if I put $data[‘pagetitle’] = ‘Page Management’; inside the manage method, it comes through.

any ideas?

 

Some other questions and suggestions…
Do you intend on adding additional information to the “edit user” page? Right now, all a user can edit is their e-mail address. 

Really, users should be able to modify their password too.  Admins should be able to change their user group from a drop down.

 Signature 

CodeIgniter From Scratch: Day 1 | Day 2 | Day 3 | Day 4 | Day 5 | Day 6 | Day 7

 
Posted: 12 September 2009 03:06 AM   [ Ignore ]   [ # 35 ]   [ Rating: 0 ]
Avatar
Joined: 2009-06-19
6267 posts

Hi,

You could pass it in like so:

function manage($data)

Also

$this
->auth->view('pages/manage'$data); 

Enjoy
InsiteFX

 Signature 

Ceritfied State of CT Computer Programming Teacher.
Custom Designed Icons, eBook Covers Software Boxes. CD, DVD Etc. New iPhone® Tab Bar Icons and iPhone® Applications Icons.

STOP! Before posting your questions, remember the WWW Golden rule:
What did you try? What did you get? What did you expect to get?

Input -> Controller | Processing -> Model | Output -> View

 
2 of 10
2