I have it, just adding in the if "&& $request->isMethod('post')":

public function executeLoginAndRegister(sfWebRequest $request){

        if($this->getUser()->getAttribute('form_signin') && $request-
>isMethod('post')){

                $this->form_signin =  $this->getUser()-
>getAttribute('form_signin');
      }

}

Anyway if my approach have any big error or is not safety i would
thank anyone who tell me.

Javi

On May 26, 3:38 pm, Javier Garcia <tirengar...@gmail.com> wrote:
> Hi,
>
> i'm trying to join two independent forms (login and register) in the
> same page.
>
> My idea is (just looking at the signin form):
>
> - Create an action that shows both forms (partials):
>
>    public function executeLoginAndRegister(sfWebRequest $request){
>
>        if($this->getUser()->getAttribute('form_signin')){
>
>             $this->form_signin =  
> $this->getUser()->getAttribute('form_signin');
>
>    }
>
> - Each partial calls to its action:
>
> <form action="<?php echo url_for('@sf_guard_signin') ?>" method="post">
>
> - In the actions i write this code
>
>    public function executeSignin($request)
>    {
>        //...
>
>       $this->form = new $MyFormclass();
>
>        if ($this->form->isValid())
>        {
>            //...
>
>        }else{
>
>             // save the form to show the error messages.
>             $this->getUser()->setAttribute('form_signin', $this->form);
>
>             return $this->forward('sfGuardAuth', 'loginAndRegister');
>
>         }
>     }
>
> It works, but, for example, if i execute LoginAndRegister and submit
> incorrectly the signin form and I go to another page and then return to
> LoginAndRegister, i will find the submiting error messages...
>
> If i execute LoginAndRegister and submit incorrectly the signin form and
> open another browser tab, i will find the submiting error messages in
> the signin form of the second tab...
>
> Any idea? any better approach?
>
> --
>
> Javi
>
> Ubuntu 8.04 - Symfony 1.3

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to