Re: [fw-general] Strategy for "panels" / "blocks"

2008-11-30 Thread Tim Nagel
I made a post to the mailing list last week about this exact problem: a
method of limiting certain actions (or parameters of an action) to internal
calls only.

I believe I have solved the solution by using a 'secureParam' class, as per
my reply [to my own post ;)]:
http://www.nabble.com/Securely-sending-information-between-actions-td20727566.html#a20727566.
I havent had time to try it yet, but afaik, it should work fine.

Any other guidance if anyone has any other suggestions would be appreciated.


T

On Mon, Dec 1, 2008 at 04:03, Thorsten Ruf <[EMAIL PROTECTED]> wrote:

> The main problem with view action helpers is, you (the user) can access the
> action simply by accessing the appropiate url, too. The access can not be
> restricted in any way. I was looking for a alternative to grant access only
> to "internal" access. Maybe Matthew can say something about handling such a
> requirement?
>
>
>


Re: [fw-general] Using current request for controller name in action helper call to submenu controller

2008-11-30 Thread Jason Webster
As you've discovered, the action view helper creates an entire new 
dispatching/request environment, and returns the result of that.


In order to achieve something closer to the results you'd like, use the 
ActionStack action helper.


It will allow to to push additional actions on to the current 
request/dispatching instance.


However, due to the nature of the request object, the controller name 
will still reflect the currently executing action, if I'm not mistaken. 
One possible way to get around this would be to pass any relevant 
information you may need as a parameter to the action (the fourth 
argument on the actionStack helper).


While not completely related, an example would be the way I handle a 
request to a resource that requires authentication within an 
application. In the preDispatch hook, it is determined if the user is 
logged in or not, and if no, the current request object is cloned, and 
passed as a parameter to a _forward call to the action that handles 
authentication. This way, I'm able to redirect the user back to the 
initially requested action upon successful authentication.


There is one more possibility I just remembered... You always have 
access to the ActionStack front controller plugin, 

and can access the full stack, and analyze that data to determine what's 
been done already.


tony stamp wrote:

Hello

I am interested in using an action helper within my view to load the
view-specific sub menu. At the moment, i am calling a menu factory during
the controllers post dispatch method to assign the menu (identified by the
requests controller name) to the view.

What i would like to do instead is simply call a SubmenuController via an
action helper and have the submenu automatically loaded from within my
layout.

The only problem i am having, is that when i use the action helper in my
layout:
action('index', 'Submenu'); ?>
... i believe the request is fired off as a separate request, not as a
continuation of the current request. This means that the method i use to
identify the current controller is no longer valid, as
$request->getControllerName() will always be SubmenuController.

Is it possible to forward the request object via an action helper? Or is
there any other / better way to make the above possible?
  




Re: [fw-general] Zend Auth: Advanced Usage By Example

2008-11-30 Thread dele454

AWESOME WORKS PERFECTLY :) Thank you so so much Bruno. I wonder why the
password placeholder is needed there.

Anyway thanks a mil :)



Bruno Friedmann-2 wrote:
> 
> Sorry Jason in Postgresql "something" refer to a db, schema, table, column
> name
> so a 0="0" -> column doesn't exist
> 
> but yes a select false = '0' is true.
> 
> But here what I've use as code which work in similar conditions
> 
> $db = Zend_Db_Table_Abstract::getDefaultAdapter();
> $dbAdapter = new Zend_Auth_Adapter_DbTable($db, 'users', 'login',
> 'password', 'MD5(?) AND active = TRUE');
> $dbAdapter->setCredential( $values['userpassword'] )
>   ->setIdentity( $values['userlogin'] );
> $result = $this->_auth->authenticate($dbAdapter);
> 
> In dele454 code it's seem you missed the place for hashed password in the
> marked place for the password
> so a
> $authAdapter = new Zend_Auth_Adapter_DbTable($db, 'Members','Email',
> 'Password', '? AND IsActive != "0"');
>  would do the trick.
> 
> 
> Jason Webster wrote:
>> Not really...
>> 
>> SELECT 0 = "0" // true
>> SELECT FALSE = "0" // true
>> SELECT FALSE = 0 // true
>> 
>> Bruno Friedmann wrote:
>>> Hi
>>> Just a word : be carefull with 0/1 TRUE/FALSE and the type of your
>>> column and the database used.
>>>
>>>
>>> I suspect if you write you
>>> $authAdapter = new Zend_Auth_Adapter_DbTable($db, 'Members',
>>>  
 'Email', 'Password', 'AND IsActive != "0"');
 
>>>
>>> AND IsActive != 0
>>>
>>> this would work ... :-)
>>> As another advice to be more SQL linguistic I would inverse the " and '
>>> "AND IsActive != '0'")
>>>
>>>
>>>
>>> dele454 wrote:
>>>  
 Am trying to implement a similar scenario where if the column
 IsActive is set
 to '0' the authentication should fail. A typical scenario is when a
 user
 just signed up and still needs to active acct before allowed to gain
 access.

 I followed the instruction in the Ref Guide but it isnt working. If
 the user
 supplies email+password before acct is activated - login is granted.

 The only code i didnt implement from the advanced useage example is the
 MD5(?) because i have something similar implemented already. Except
 if it
 does something else - i cant loggin with any credentials if i include
 it
 though


 $db= Zend_Registry::get('db');
 $authAdapter = new Zend_Auth_Adapter_DbTable($db,
 'Members',
 'Email', 'Password', 'AND IsActive != "0"');

 $config = Zend_Registry::get('config');
 $password = $logins['password'];
 $salt = "$^&##&@";
 $password =
 md5($salt.$logins['password']);

 $authAdapter->setIdentity($logins['email']);
 $authAdapter->setCredential($password);
 return $authAdapter;   

 Please help is needed thanks :)

 -
 dee
 
>>>
>>>
>>>   
>> 
> 
> 
> -- 
> 
>  Bruno Friedmann
> 
> Ioda-Net Sàrl
>   2830 Vellerat - Switzerland
> 
>   Tél : ++41 32 435 7171
>   Fax : ++41 32 435 7172
>   gsm : ++41 78 802 6760
>   www.ioda-net.ch
> 
>  Centre de Formation et de Coaching En Ligne
>  www.cfcel.com
> 
> 
> 


-
dee
-- 
View this message in context: 
http://www.nabble.com/Zend-Auth%3A-Advanced-Usage-By-Example-tp20740513p20760477.html
Sent from the Zend Framework mailing list archive at Nabble.com.



[fw-general] Using current request for controller name in action helper call to submenu controller

2008-11-30 Thread tony stamp

Hello

I am interested in using an action helper within my view to load the
view-specific sub menu. At the moment, i am calling a menu factory during
the controllers post dispatch method to assign the menu (identified by the
requests controller name) to the view.

What i would like to do instead is simply call a SubmenuController via an
action helper and have the submenu automatically loaded from within my
layout.

The only problem i am having, is that when i use the action helper in my
layout:
action('index', 'Submenu'); ?>
... i believe the request is fired off as a separate request, not as a
continuation of the current request. This means that the method i use to
identify the current controller is no longer valid, as
$request->getControllerName() will always be SubmenuController.

Is it possible to forward the request object via an action helper? Or is
there any other / better way to make the above possible?
-- 
View this message in context: 
http://www.nabble.com/Using-current-request-for-controller-name-in-action-helper-call-to-submenu-controller-tp20760333p20760333.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend Auth: Advanced Usage By Example

2008-11-30 Thread dele454

Thanks for your response. Doesnt work either. Access is stillo granted :(



Bruno Friedmann-2 wrote:
> 
> Hi
> Just a word : be carefull with 0/1 TRUE/FALSE and the type of your column
> and the database used.
> 
> 
> I suspect if you write you
> $authAdapter = new Zend_Auth_Adapter_DbTable($db, 'Members',
>> 'Email', 'Password', 'AND IsActive != "0"');
> 
> AND IsActive != 0
> 
> this would work ... :-)
> As another advice to be more SQL linguistic I would inverse the " and '
> "AND IsActive != '0'")
> 
> 
> 
> dele454 wrote:
>> Am trying to implement a similar scenario where if the column IsActive is
>> set
>> to '0' the authentication should fail. A typical scenario is when a user
>> just signed up and still needs to active acct before allowed to gain
>> access.
>> 
>> I followed the instruction in the Ref Guide but it isnt working. If the
>> user
>> supplies email+password before acct is activated - login is granted.
>> 
>> The only code i didnt implement from the advanced useage example is the
>> MD5(?) because i have something similar implemented already. Except if it
>> does something else - i cant loggin with any credentials if i include it
>> though
>> 
>> 
>> $db= Zend_Registry::get('db');
>> $authAdapter = new Zend_Auth_Adapter_DbTable($db,
>> 'Members',
>> 'Email', 'Password', 'AND IsActive != "0"');
>> 
>> $config = Zend_Registry::get('config');
>>  $password = $logins['password'];
>>  $salt = "$^&##&@";
>> $password =
>> md5($salt.$logins['password']);
>>  
>>  $authAdapter->setIdentity($logins['email']);
>>  $authAdapter->setCredential($password);
>>  return $authAdapter;
>> 
>> Please help is needed thanks :)
>> 
>> -
>> dee
> 
> 
> -- 
> 
>  Bruno Friedmann
> 
> Ioda-Net Sàrl
>   2830 Vellerat - Switzerland
> 
>   Tél : ++41 32 435 7171
>   Fax : ++41 32 435 7172
>   gsm : ++41 78 802 6760
>   www.ioda-net.ch
> 
>  Centre de Formation et de Coaching En Ligne
>  www.cfcel.com
> 
> 
> 


-
dee
-- 
View this message in context: 
http://www.nabble.com/Zend-Auth%3A-Advanced-Usage-By-Example-tp20740513p20760074.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Strategy for "panels" / "blocks"

2008-11-30 Thread Thorsten Ruf
The main problem with view action helpers is, you (the user) can access the
action simply by accessing the appropiate url, too. The access can not be
restricted in any way. I was looking for a alternative to grant access only
to "internal" access. Maybe Matthew can say something about handling such a
requirement?

On Sun, Nov 30, 2008 at 17:24, Joó Ádám <[EMAIL PROTECTED]> wrote:

> Check out the action view helper:
>
> http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.action
> You could call it in your layout script.
>
>
> Regards,
> Ádám
>


Re: [fw-general] Strategy for "panels" / "blocks"

2008-11-30 Thread Joó Ádám
Check out the action view helper:
http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.action
You could call it in your layout script.


Regards,
Ádám


[fw-general] Strategy for "panels" / "blocks"

2008-11-30 Thread hukkas

I'm building a web application/ framework and I'm trying to implement
blocks/panels (boxes on the right hand side, essentially, choose your own
terminology).

It's not necessarily that hard from a technical point-of-view (bar one thing
that I'm not quite sure how to do), but what I'm looking for is a
consistent, logical approach - any ideas would be appreciated.

My approach so far has been as follows;
- I'm using the placeHolder helper to inject the boxes into the layout
- I've got a "box" view script to render the box, with the title, css class
and content as member variables
- I have a Controller helper to render a box, which essentially creates an
instance of the Box view script, injects the parameters and prepends /
appends the result to the appropriate placeholder

Some of the boxes are common to all/most pages, so I'm performing this in a
Controller plugin.

What would be most useful, however, is to create boxes using actions
attached to the various modules and controllers.  E.g., a list of online
users would be best created by the User controller, but inserted into the
page using a Controller plugin (e.g. in a postDispatch method).  Also, by
creating a box using a Controller/Action, I'd be making it easy to switch my
application to rendering boxes using an AJAX call.  What would be the best
way to do this?  Is there an easy and logical way of, say, firing off a call
to /user/online and injecting the result into a method within a Controller
plugin?

I'd imagine many people have thought about this, so I'd be interested to get
a discussion going about peoples' approaches.

Thanks
-- 
View this message in context: 
http://www.nabble.com/Strategy-for-%22panels%22---%22blocks%22-tp20758783p20758783.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Dojo vs Prototype

2008-11-30 Thread Matthew Weier O'Phinney
-- Marc Grue <[EMAIL PROTECTED]> wrote
(on Sunday, 30 November 2008, 05:45 AM -0800):
> I have earlier used the Prototype library to pull asynchronous data from a
> standalone script file 'ajax_srcipt', more or less like this: 
> 
> .. load prototype libraries
> onclick="Javascrip:do_something_with(
> new Ajax.Updater({success: 'ajax_script'}, 'ajax_script_path_with_vars',
> {evalScripts: true});
> )"
> 
> Is there a "Dojo"-way to do this?
> 
> Should I call an ajax-action in a controller that would then return the
> calculated data? (I miss controller examples in the manual)

Look into dojo.xhr:


http://dojotoolkit.org/book/dojo-book-0-9/part-3-programmatic-dijit-and-dojo/ajax-transports

There's not a direct equivalent to Ajax.Updater, but it's trivial to use
dojo.place to inject the content into your DOM via a load callback.

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


Re: [fw-general] dojo tooltip in a contentpane

2008-11-30 Thread Matthew Weier O'Phinney
-- aad pouw <[EMAIL PROTECTED]> wrote
(on Sunday, 30 November 2008, 04:56 AM -0800):
> Before I go on with this issue, I first want to mention this.
> ZFW 1.7 needs a patch to get the Zend_Dojo_View_Helper_Tooltip working
> anyhow and 
> that's to be found at http://framework.zend.com/issues/browse/ZF-4635. 

Since we were not able to get it into 1.7, at this point, it's scheduled
for 1.8 (no new features in mini releases).

> Then my issue.
> I just don't get it work with a contentpane. It's not the helper itself
> because I can see in firebug/php that is is loading properly. 
> It's like that I just missing or do something wrong in the code? 
> 
> dojo()->enable()?>
> 
> TabContainer()->captureStart('main-content', array('class' =>
> 'main-content'))?>
> Tooltip('tooltip1',array('connectId' => 'tab1','label' =>
> 'Home'))?>

Contrary to what you say, you're putting it in the TabContainer body,
not one of the content panes... try putting this call *after* the
TabContainer has been fully setup, and see if that makes a difference.

> contentPane('tab1','', array('title' => 'tab1', 'href' =>
> $this->url(array('controller' => 'content', 'action' => 'tab1'), 'default',
> true), 'parseOnLoad' => true, 'selected' => true))?>
> contentPane('tab2','', array('title' => 'tab2', 'href' =>
> $this->url(array('controller' => 'content', 'action' => 'tab2'), 'default',
> true)))?>
> contentPane('tab3','', array('title' => 'tab3', 'href' =>
> $this->url(array('controller' => 'content', 'action' => 'tab3'), 'default',
> true)))?>
> contentPane('tab4','', array('title' => 'tab4', 'href' =>
> $this->url(array('controller' => 'content', 'action' => 'tab4'), 'default',
> true)))?>
> contentPane('tab5','', array('title' => 'tab5', 'href' =>
> $this->url(array('controller' => 'content', 'action' => 'tab5'), 'default',
> true)))?>
> TabContainer()->captureEnd('main-content')?>
> 

-- 
Matthew Weier O'Phinney
Software Architect   | [EMAIL PROTECTED]
Zend Framework   | http://framework.zend.com/


[fw-general] Zend_Dojo vs Prototype

2008-11-30 Thread Marc Grue

I have earlier used the Prototype library to pull asynchronous data from a
standalone script file 'ajax_srcipt', more or less like this: 

.. load prototype libraries
onclick="Javascrip:do_something_with(
new Ajax.Updater({success: 'ajax_script'}, 'ajax_script_path_with_vars',
{evalScripts: true});
)"

Is there a "Dojo"-way to do this?

Should I call an ajax-action in a controller that would then return the
calculated data? (I miss controller examples in the manual)
-- 
View this message in context: 
http://www.nabble.com/Zend_Dojo-vs-Prototype-tp20757810p20757810.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Working progressbar demo

2008-11-30 Thread Isaak Malik
I found the problem because I noticed uploadprogress_get_info() was nowhere
defined. We need the uploadprogress PECL extension, it would be very helpful
if this was mentioned in the demo or in the manual...

Thanks for the help Ben

On Sun, Nov 30, 2008 at 2:08 PM, Isaak Malik <[EMAIL PROTECTED]> wrote:

> Both are not working for me, upload one gives a "Caught Exception:
> undefined" error and second one does nothing.
>
> I decided to take a look into the source code and changed (in the
> Upload.php demo):
>
> catch(e) {
> alert('Caught Exception: ' + e.description);
> }
> into:
>
> catch(e) {
> alert('Caught Exception: ' + e.message);
> }
>
> And now it gives me a "Caught Exception: unterminated regular expression
> literal" error. I'll have a deeper look into it later today.
>
>
> On Sun, Nov 30, 2008 at 1:10 PM, Ben Scholzen 'DASPRiD' <[EMAIL 
> PROTECTED]>wrote:
>
>> -BEGIN PGP SIGNED MESSAGE-
>> Hash: SHA1
>>
>> Is it about the upload demo or the jsPush demo? If it's the latter one,
>> I'll setup an apache2 in my windows VirtualBox, but else I don't have
>> any idea why it is not working for you.
>> ...
>> :  ___   _   ___ ___ ___ _ ___:
>> : |   \ /_\ / __| _ \ _ (_)   \   :
>> : | |) / _ \\__ \  _/   / | |) |  :
>> : |___/_/:\_\___/_| |_|_\_|___/   :
>> :::
>> : Web: http://www.dasprids.de :
>> : E-mail : [EMAIL PROTECTED]   :
>> : Jabber : [EMAIL PROTECTED] :
>> : ICQ: 105677955  :
>> :::
>>
>>
>> Isaak Malik schrieb:
>> > Hello again Ben,
>> >
>> > It's not caused by my antivirus software as far as I know because I've
>> > disabled it while trying. Using Nod32 by the way.
>> >
>> > I had a suspicion that having output_buffering enabled might have caused
>> > the "Catched Exception: undefined" error but I just gave it a try while
>> > having it disabled and the result was the same.
>> >
>> > Regards,
>> > Isaak
>> -BEGIN PGP SIGNATURE-
>> Version: GnuPG v1.4.9 (GNU/Linux)
>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>>
>> iEYEARECAAYFAkkygssACgkQ0HfT5Ws789BNQQCgsVTp8WWTZd03lxC6Y/S7DTpZ
>> r+IAoLSBO0gNAbeNEGjNg9vHSuH4Nyhf
>> =J+ss
>> -END PGP SIGNATURE-
>>
>
>
>
> --
> Isaak Malik
> Web Developer
>



-- 
Isaak Malik
Web Developer


Re: [fw-general] Working progressbar demo

2008-11-30 Thread Isaak Malik
Both are not working for me, upload one gives a "Caught Exception:
undefined" error and second one does nothing.

I decided to take a look into the source code and changed (in the Upload.php
demo):

catch(e) {
alert('Caught Exception: ' + e.description);
}
into:

catch(e) {
alert('Caught Exception: ' + e.message);
}

And now it gives me a "Caught Exception: unterminated regular expression
literal" error. I'll have a deeper look into it later today.

On Sun, Nov 30, 2008 at 1:10 PM, Ben Scholzen 'DASPRiD' <[EMAIL 
PROTECTED]>wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> Is it about the upload demo or the jsPush demo? If it's the latter one,
> I'll setup an apache2 in my windows VirtualBox, but else I don't have
> any idea why it is not working for you.
> ...
> :  ___   _   ___ ___ ___ _ ___:
> : |   \ /_\ / __| _ \ _ (_)   \   :
> : | |) / _ \\__ \  _/   / | |) |  :
> : |___/_/:\_\___/_| |_|_\_|___/   :
> :::
> : Web: http://www.dasprids.de :
> : E-mail : [EMAIL PROTECTED]   :
> : Jabber : [EMAIL PROTECTED] :
> : ICQ: 105677955  :
> :::
>
>
> Isaak Malik schrieb:
> > Hello again Ben,
> >
> > It's not caused by my antivirus software as far as I know because I've
> > disabled it while trying. Using Nod32 by the way.
> >
> > I had a suspicion that having output_buffering enabled might have caused
> > the "Catched Exception: undefined" error but I just gave it a try while
> > having it disabled and the result was the same.
> >
> > Regards,
> > Isaak
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEYEARECAAYFAkkygssACgkQ0HfT5Ws789BNQQCgsVTp8WWTZd03lxC6Y/S7DTpZ
> r+IAoLSBO0gNAbeNEGjNg9vHSuH4Nyhf
> =J+ss
> -END PGP SIGNATURE-
>



-- 
Isaak Malik
Web Developer


[fw-general] dojo tooltip in a contentpane

2008-11-30 Thread aad pouw

Hi all

Before I go on with this issue, I first want to mention this.
ZFW 1.7 needs a patch to get the Zend_Dojo_View_Helper_Tooltip working
anyhow and 
that's to be found at http://framework.zend.com/issues/browse/ZF-4635. 

Then my issue.
I just don't get it work with a contentpane. It's not the helper itself
because I can see in firebug/php that is is loading properly. 
It's like that I just missing or do something wrong in the code? 

dojo()->enable()?>

TabContainer()->captureStart('main-content', array('class' =>
'main-content'))?>
Tooltip('tooltip1',array('connectId' => 'tab1','label' =>
'Home'))?>
contentPane('tab1','', array('title' => 'tab1', 'href' =>
$this->url(array('controller' => 'content', 'action' => 'tab1'), 'default',
true), 'parseOnLoad' => true, 'selected' => true))?>
contentPane('tab2','', array('title' => 'tab2', 'href' =>
$this->url(array('controller' => 'content', 'action' => 'tab2'), 'default',
true)))?>
contentPane('tab3','', array('title' => 'tab3', 'href' =>
$this->url(array('controller' => 'content', 'action' => 'tab3'), 'default',
true)))?>
contentPane('tab4','', array('title' => 'tab4', 'href' =>
$this->url(array('controller' => 'content', 'action' => 'tab4'), 'default',
true)))?>
contentPane('tab5','', array('title' => 'tab5', 'href' =>
$this->url(array('controller' => 'content', 'action' => 'tab5'), 'default',
true)))?>
TabContainer()->captureEnd('main-content')?>


Has someone any ideas?
Thanks,
Aad Pouw
-- 
View this message in context: 
http://www.nabble.com/dojo-tooltip-in-a-contentpane-tp20757413p20757413.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Working progressbar demo

2008-11-30 Thread Ben Scholzen 'DASPRiD'
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Is it about the upload demo or the jsPush demo? If it's the latter one,
I'll setup an apache2 in my windows VirtualBox, but else I don't have
any idea why it is not working for you.
...
:  ___   _   ___ ___ ___ _ ___:
: |   \ /_\ / __| _ \ _ (_)   \   :
: | |) / _ \\__ \  _/   / | |) |  :
: |___/_/:\_\___/_| |_|_\_|___/   :
:::
: Web: http://www.dasprids.de :
: E-mail : [EMAIL PROTECTED]   :
: Jabber : [EMAIL PROTECTED] :
: ICQ: 105677955  :
:::


Isaak Malik schrieb:
> Hello again Ben,
> 
> It's not caused by my antivirus software as far as I know because I've
> disabled it while trying. Using Nod32 by the way.
> 
> I had a suspicion that having output_buffering enabled might have caused
> the "Catched Exception: undefined" error but I just gave it a try while
> having it disabled and the result was the same.
> 
> Regards,
> Isaak
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkkygssACgkQ0HfT5Ws789BNQQCgsVTp8WWTZd03lxC6Y/S7DTpZ
r+IAoLSBO0gNAbeNEGjNg9vHSuH4Nyhf
=J+ss
-END PGP SIGNATURE-


Re: [fw-general] Zend Auth: Advanced Usage By Example

2008-11-30 Thread Bruno Friedmann
Sorry Jason in Postgresql "something" refer to a db, schema, table, column name
so a 0="0" -> column doesn't exist

but yes a select false = '0' is true.

But here what I've use as code which work in similar conditions

$db = Zend_Db_Table_Abstract::getDefaultAdapter();
$dbAdapter = new Zend_Auth_Adapter_DbTable($db, 'users', 'login', 'password', 
'MD5(?) AND active = TRUE');
$dbAdapter->setCredential( $values['userpassword'] )
  ->setIdentity( $values['userlogin'] );
$result = $this->_auth->authenticate($dbAdapter);

In dele454 code it's seem you missed the place for hashed password in the 
marked place for the password
so a
$authAdapter = new Zend_Auth_Adapter_DbTable($db, 'Members','Email', 
'Password', '? AND IsActive != "0"');
 would do the trick.


Jason Webster wrote:
> Not really...
> 
> SELECT 0 = "0" // true
> SELECT FALSE = "0" // true
> SELECT FALSE = 0 // true
> 
> Bruno Friedmann wrote:
>> Hi
>> Just a word : be carefull with 0/1 TRUE/FALSE and the type of your
>> column and the database used.
>>
>>
>> I suspect if you write you
>> $authAdapter = new Zend_Auth_Adapter_DbTable($db, 'Members',
>>  
>>> 'Email', 'Password', 'AND IsActive != "0"');
>>> 
>>
>> AND IsActive != 0
>>
>> this would work ... :-)
>> As another advice to be more SQL linguistic I would inverse the " and '
>> "AND IsActive != '0'")
>>
>>
>>
>> dele454 wrote:
>>  
>>> Am trying to implement a similar scenario where if the column
>>> IsActive is set
>>> to '0' the authentication should fail. A typical scenario is when a user
>>> just signed up and still needs to active acct before allowed to gain
>>> access.
>>>
>>> I followed the instruction in the Ref Guide but it isnt working. If
>>> the user
>>> supplies email+password before acct is activated - login is granted.
>>>
>>> The only code i didnt implement from the advanced useage example is the
>>> MD5(?) because i have something similar implemented already. Except
>>> if it
>>> does something else - i cant loggin with any credentials if i include it
>>> though
>>>
>>>
>>> $db= Zend_Registry::get('db');
>>> $authAdapter = new Zend_Auth_Adapter_DbTable($db,
>>> 'Members',
>>> 'Email', 'Password', 'AND IsActive != "0"');
>>>
>>> $config = Zend_Registry::get('config');
>>> $password = $logins['password'];
>>> $salt = "$^&##&@";
>>> $password =
>>> md5($salt.$logins['password']);
>>>
>>> $authAdapter->setIdentity($logins['email']);
>>> $authAdapter->setCredential($password);
>>> return $authAdapter;   
>>>
>>> Please help is needed thanks :)
>>>
>>> -
>>> dee
>>> 
>>
>>
>>   
> 


-- 

 Bruno Friedmann

Ioda-Net Sàrl
  2830 Vellerat - Switzerland

  Tél : ++41 32 435 7171
  Fax : ++41 32 435 7172
  gsm : ++41 78 802 6760
  www.ioda-net.ch

 Centre de Formation et de Coaching En Ligne
 www.cfcel.com