Created
June 6, 2011 00:38
-
-
Save 77web/1009593 to your computer and use it in GitHub Desktop.
OpenPNE3.xで外部ログインページ(静的HTML,他システム…)にjavascriptでログインフォームを埋め込む
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class jsLoginAction extends sfAction | |
{ | |
public function execute($request) | |
{ | |
if(!$this->getUser()->hasCredential('SNSMember')) | |
{ | |
$this->forms = $this->getUser()->getAuthForms(); | |
foreach($this->forms as $form) | |
{ | |
$form->getWidget('next_uri')->setAttribute('value', '@homepage'); | |
$form->setDefault('next_uri', '@homepage'); | |
} | |
} | |
return sfView::SUCCESS; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php slot('js'); ?> | |
<?php if($sf_user->hasCredential('SNSMember')): ?> | |
<?php echo $sf_user->getMember()->getName(); ?> | |
<?php else: ?> | |
<?php foreach($forms as $form): ?> | |
<?php include_login_parts('Login', $form, 'member/login'); ?> | |
<?php endforeach; ?> | |
<?php endif; ?> | |
<?php end_slot(); ?> | |
document.write('<?php echo str_replace(array("\r", "\n"), '', get_slot('js')); ?>'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all: | |
is_secure: true | |
credentials: SNSMember | |
registerInput: | |
credentials: [[SNSRegisterBegin, SNSRegisterFinish]] | |
configComplete: | |
is_secure: false | |
changeLanguage: | |
is_secure: false | |
registerMobileToRegisterEnd: | |
credentials: SNSRegisterFinish | |
registerMobileToRegisterEndFinish: | |
is_secure: false | |
jsLogin: | |
is_secure: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<title>test page</title> | |
</head> | |
<body> | |
<div id="testLoginForm"> | |
↓ここにログインフォームが埋め込まれます↓ | |
<script type="text/javascript" src="http://opskinfacebookplugin.77-web.com/member/jsLogin"></script> | |
↑ここにログインフォームが埋め込まれます↑ | |
</div> | |
<pre> | |
設置方法 | |
0.SNS設定を「外部ログインページ利用」に変更しておく | |
1.このgistのusage.html以外のファイルを下記のように配置 | |
apps/pc_frontend/modules/member/actions/jsLoginAction.class.php | |
apps/pc_frontend/modules/member/templates/jsLoginSuccess.php | |
apps/pc_frontend/modules/member/config/security.yml | |
apps/pc_frontend/modules/member/config/view.yml | |
2.キャッシュクリア | |
php symfony ccまたはpc_backend>SNS設定>キャッシュクリア で実行。 | |
3.ログインフォームを設置したい場所にscriptタグを設置 | |
<script type="text/javascript" src="http://(SNSのURL)/member/jsLogin"></script> | |
</pre> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
homeSuccess: | |
javascripts: [%SF_PROTOTYPE_WEB_DIR%/js/prototype, util] | |
layout: layoutA | |
customize: | |
cautionAboutFriendPre: | |
template: [friend, cautionAboutFriendPre] | |
parts : [information] | |
target : [bodyBottom] | |
cautionAboutCommunityMemberPre: | |
template : [community, cautionAboutCommunityMemberPre] | |
parts : [information] | |
target : [bodyBottom] | |
is_component: true | |
cautionAboutChangeAdminRequest: | |
template : [community, cautionAboutChangeAdminRequest] | |
parts : [information] | |
target : [bodyBottom] | |
is_component: true | |
cautionAboutSubAdminRequest: | |
template : [community, cautionAboutSubAdminRequest] | |
parts : [information] | |
target : [bodyBottom] | |
is_component: true | |
profileSuccess: | |
layout: layoutA | |
configSuccess: | |
layout: layoutB | |
loginSuccess: | |
layout: layoutA | |
jsLoginSuccess: | |
has_layout: false | |
http_metas: | |
content-type: text/javascript |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment