mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 17:46:05 -05:00
FIX: Support create account on facebook browser
This commit is contained in:
parent
dffe50a2e6
commit
eff2865278
2 changed files with 18 additions and 2 deletions
|
@ -0,0 +1,13 @@
|
||||||
|
export default {
|
||||||
|
name: "auth-complete",
|
||||||
|
after: "inject-objects",
|
||||||
|
initialize() {
|
||||||
|
if (window.location.search.indexOf('authComplete=true') !== -1) {
|
||||||
|
const lastAuthResult = localStorage.getItem('lastAuthResult');
|
||||||
|
if (lastAuthResult) {
|
||||||
|
Discourse.authenticationComplete(JSON.parse(lastAuthResult));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
|
@ -22,12 +22,15 @@
|
||||||
<p><%=t "login.close_window" %></p>
|
<p><%=t "login.close_window" %></p>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
var authResult = <%=@auth_result.to_client_hash.to_json.html_safe%>;
|
||||||
|
|
||||||
// On facebook browser, just redirect and don't close
|
// On facebook browser, just redirect and don't close
|
||||||
var ua = navigator.userAgent || navigator.vendor || window.opera;
|
var ua = navigator.userAgent || navigator.vendor || window.opera;
|
||||||
if ((ua.indexOf("FBAN") > -1) || (ua.indexOf("FBAV") > -1)) {
|
if ((ua.indexOf("FBAN") > -1) || (ua.indexOf("FBAV") > -1)) {
|
||||||
window.location.href = '<%= Discourse.base_url.html_safe %>';
|
localStorage.setItem('lastAuthResult', JSON.stringify(authResult));
|
||||||
|
window.location.href = '<%= Discourse.base_url.html_safe %>?authComplete=true';
|
||||||
} else {
|
} else {
|
||||||
window.opener.Discourse.authenticationComplete(<%=@auth_result.to_client_hash.to_json.html_safe%>);
|
window.opener.Discourse.authenticationComplete(authResult);
|
||||||
window.close();
|
window.close();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in a new issue