Yii的用户和Yii开发eauth整合

问题描述:

我试图用拼凑的应用程序警予用户警予-eauth 扩展,但我来了短了。当我创建一个新的Web应用程序并安装eauth我可以得到它做工精细,所以我知道我没有做错任何事上结束。我认为,问题在于我的网址。这是什么是应该要像一个演示: http://nodge.ru/yii- eauth /演示/登录。当有人点击说,谷歌应该把你带到谷歌登录页面,但在我的应用我得到一个404错误,指出系统无法找到所请求的操作登录。此URL是用户/用户/登录/服务/ google_oauth ,而URL应该读用户/登录/服务/ google_oauth 。在此输入到浏览器中手动我重定向到正确的页面。

I am trying to put together an application using yii-user and yii-eauth extensions but I am coming up short. When I create a new webapp and install eauth I can get it to work fine so I know that I am not doing anything wrong on that end. I think the problem lies with my urls. This is a demo of what it is supposed to be like: http://nodge.ru/yii-eauth/demo/login. When someone clicks on say google it should bring you to the google sign in page but on my application I am getting a 404 error that states "The system is unable to find the requested action "login"." The url for this is user/user/login/service/google_oauth whereas the url should read user/login/service/google_oauth. Upon typing this into the browser manually I am redirected to the right page.

所以,我接过来一看到 EAuthWidget.php 类,看看我是否能找出它是越来越额外的用户,从但我无法算出它出。我认为它可能有事可做的事实,我有这个用户模块这是在 /模块/用户目录在我的webapp英寸我也试着使用 URLManager 指向正确的地址,但没有运气。

So I took a look into the EAuthWidget.php class to see if I could find out where it was getting that extra "user" from but I could not figure it out. I think it may have something to do with the fact that I have this in the user module which is in the /modules/user directory in my webapp. I also tried to use the URLManager to point to the right address but with no luck.

有没有人有任何类似的经验,设置此功能?或者有什么建议?

Does anyone have any similar experiences setting this up? Or any suggestions?

您只需要更改您的视图小部件初始化code(即修改动作小部件的属性),有点像这样的:

You just need to change the widget initialization code in your view(namely change the action property of the widget), somewhat like this:

<h2>Do you already have an account on one of these sites? Click the logo to log in with it here:</h2>
<?php 
  $this->widget('ext.eauth.EAuthWidget', array('action' => 'login'));
?>

我想补充,请记住,这个动作取决于的查看哪个的要包括这个小部件,如果视图是的保护/视图/网站/ login.php中的(这是警予的默认站点登录视图),那么行动应该能够进入警予用户模块的登陆行动,因此这将是:'行动'=&GT;'/用户/登录,但是,如果要包括这个小部件的Yii用户的的保护/模块/用户/视图/用户/ login.php中的,则动作将登录前面已经提到。

Just to add, keep in mind that this action depends on which view you are including this widget, if the view is protected/views/site/login.php (which is yii's default site login view) then action should be able to go to the yii-user module's login action, so it'll be : 'action'=>'/user/login' , however if you are including this widget in yii-user's protected/modules/user/views/user/login.php then the action will be 'login' as already mentioned.