sfDoctrineGuard 问题

发布于 2024-08-20 20:54:55 字数 1533 浏览 6 评论 0原文

我的 sfDoctrineGuardPlugin 有问题...这个问题与...

两个表与 sfDoctrineGuard 用户表 (symfony) 相关

我创建实体 Enterprise 和 Customer,并与其组和实体良好关联。现在我创建一个名为 sfGuard 的模块,其中包含signinSucces.php,因为我想自定义它,代码是:

public function executeSignin($request)
  {
    $this->form = new LoginForm();
    if ( $request->isMethod('post')){
        $this->processForm($request, $this->form);  
    }       
  }

  protected function processForm(sfWebRequest $request, sfForm $form)
  {
    $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));    
    if ($form->isValid())
    {
      parent::executeSignin($request);   

    }
  }

我的登录表单代码是...

class LoginForm extends sfGuardUserForm
{
  public function configure()
  {

    $this->useFields(array('username', 'password'));
    unset($this['id']);

    $this->widgetSchema->setLabels(array(
      'username'    => 'Email',
      'password'    => 'Pass'
    )); 
     $this->setValidators(array(
      'username'   => new sfValidatorEmail(array('required' => true)),  
      'password' => new sfValidatorString(array('required' => true))
    ));
  }  
}

好吧,如果我尝试登录,它会返回错误:“用户名和/或密码是无效的。”我确信用户名和密码是正确的。我的问题是:

1)有什么方法可以显示未在 sha1 中加密的密码?加密真是太好了,但这样我永远看不到用户密码是否正确。 2)如果我填写了正确的用户名和密码,怎么可能无法正确登录? 3)我做得很好吗?

多谢。

I have a problem with my sfDoctrineGuardPlugin... this question is related to...

Two tables relation with sfDoctrineGuard user table (symfony)

I create the entity Enterprise and Customer and associate well with their group and entity. Now i create a module called sfGuard whith signinSucces.php because i want to custom that and the code is:

public function executeSignin($request)
  {
    $this->form = new LoginForm();
    if ( $request->isMethod('post')){
        $this->processForm($request, $this->form);  
    }       
  }

  protected function processForm(sfWebRequest $request, sfForm $form)
  {
    $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));    
    if ($form->isValid())
    {
      parent::executeSignin($request);   

    }
  }

My loginForm code is...

class LoginForm extends sfGuardUserForm
{
  public function configure()
  {

    $this->useFields(array('username', 'password'));
    unset($this['id']);

    $this->widgetSchema->setLabels(array(
      'username'    => 'Email',
      'password'    => 'Pass'
    )); 
     $this->setValidators(array(
      'username'   => new sfValidatorEmail(array('required' => true)),  
      'password' => new sfValidatorString(array('required' => true))
    ));
  }  
}

Well, if I try to do login it returns me error: "The username and/or password is invalid." and i'm sure that username an password are correct. My questions are:

1) There are any way to show password not encripted in sha1? It's so good to encrypt but at this way i never can see if the user password is OK.
2) How is possible that if i fill correct username and password it don't login correctly?
3) I'm doing it well?

thanks a lot.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

计㈡愣 2024-08-27 20:54:55

1)登录场景在插件的sfGuardAuth模块中,打开它就可以看到里面的所有内容
2)另外,看看代码
3) 取决于您的期望

那么,您想要进行什么样的定制?

1) Sign-in scenario is in sfGuardAuth module of plugin, just open it and you can see all things there
2) Also, look at the code
3) Depends on what you expect

So, what kind of customization you want to do?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文