add facebook login module, hwi/HWIOAuthBundle
This commit is contained in:
@@ -3,6 +3,46 @@
|
||||
{% trans_default_domain 'FOSUserBundle' %}
|
||||
|
||||
{% block fos_user_content %}
|
||||
<script>
|
||||
window.fbAsyncInit = function() {
|
||||
FB.init({
|
||||
appId : '320599508311862',
|
||||
xfbml : true,
|
||||
version : 'v2.8'
|
||||
});
|
||||
FB.AppEvents.logPageView();
|
||||
};
|
||||
|
||||
(function(d, s, id){
|
||||
var js, fjs = d.getElementsByTagName(s)[0];
|
||||
if (d.getElementById(id)) {return;}
|
||||
js = d.createElement(s); js.id = id;
|
||||
js.src = "//connect.facebook.net/en_US/sdk.js";
|
||||
fjs.parentNode.insertBefore(js, fjs);
|
||||
}(document, 'script', 'facebook-jssdk'));
|
||||
|
||||
function fb_login() {
|
||||
FB.getLoginStatus(function(response) {
|
||||
if (response.status === 'connected') {
|
||||
// connected
|
||||
alert('Already connected, redirect to login page to create token.');
|
||||
document.location = "{{ url("hwi_oauth_service_redirect", {service: "facebook"}) }}";
|
||||
} else {
|
||||
// not_authorized
|
||||
FB.login(function(response) {
|
||||
if (response.authResponse) {
|
||||
document.location = "{{ url("hwi_oauth_service_redirect", {service: "facebook"}) }}";
|
||||
} else {
|
||||
alert('Cancelled.');
|
||||
}
|
||||
}, {scope: 'email'});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<a href="#" onclick="fb_login();">Facebook Connect Button (Dialog)</a>
|
||||
|
||||
{% if error %}
|
||||
{{ error.messageKey|trans(error.messageData, 'security') }}
|
||||
{% endif %}
|
||||
@@ -12,11 +52,11 @@
|
||||
|
||||
<input type="text" id="username" name="_username" value="{{ last_username }}"
|
||||
placeholder="{{ 'security.login.username'|trans }}"
|
||||
required="required" autofocus/>
|
||||
autofocus/>
|
||||
|
||||
<input type="password" id="password" name="_password"
|
||||
placeholder="{{ 'security.login.password'|trans }}"
|
||||
required="required"/>
|
||||
/>
|
||||
|
||||
<input type="checkbox" id="remember_me" name="_remember_me" value="on"/>
|
||||
<label for="remember_me">{{ 'security.login.remember_me'|trans }}</label>
|
||||
|
||||
Reference in New Issue
Block a user