aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-06-21 21:53:47 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:53 +0300
commit2b02456c23ecec6039278cbdc5362a9551b9a58a (patch)
tree4ab9955d929545a17cee9ec4c5189fbf36da25a9
parente35f3844e62735de9969c400a2d2fb16fde8d85d (diff)
Facebook login
-rw-r--r--vnext/src/components/LoginButton.js3
-rw-r--r--vnext/src/index.js9
2 files changed, 9 insertions, 3 deletions
diff --git a/vnext/src/components/LoginButton.js b/vnext/src/components/LoginButton.js
index 6f698e16..558f61f4 100644
--- a/vnext/src/components/LoginButton.js
+++ b/vnext/src/components/LoginButton.js
@@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
import Icon from './Icon';
import Modal from './Modal';
-
export default class LoginButton extends React.Component {
constructor(props) {
super(props);
@@ -58,7 +57,7 @@ export default class LoginButton extends React.Component {
onClose={this.toggleModal}>
<div className="dialoglogin">
<p>Please, introduce yourself:</p>
- <a href="/_fblogin" id="signfb"><Icon name="ei-sc-facebook" size="s" />Login with facebook</a>
+ <a href={`https://api.juick.com/_fblogin?state=${window.location.protocol}//${window.location.host}/_fblogin`} id="signfb"><Icon name="ei-sc-facebook" size="s" />Login with facebook</a>
<a href="/_vklogin" id="signvk"><Icon name="ei-sc-vk" size="s" />Login with VK</a>
<p>Already registered?</p>
<form onSubmit={this.login.bind(this)}>
diff --git a/vnext/src/index.js b/vnext/src/index.js
index 7ba41fc1..848a689e 100644
--- a/vnext/src/index.js
+++ b/vnext/src/index.js
@@ -1,6 +1,8 @@
import React from 'react';
import ReactDOM from 'react-dom';
-import { BrowserRouter as Router, Route, Link, Switch } from 'react-router-dom';
+import { BrowserRouter as Router, Route, Link, Switch, Redirect } from 'react-router-dom';
+import * as qs from 'query-string';
+
import Icon from './components/Icon';
import { Discover, Discussions, Blog, Tag, Home } from './components/Feeds';
import Settings from './components/Settings';
@@ -136,6 +138,11 @@ class App extends React.Component {
<Route exact path="/settings" render={(props) =>
<Settings visitor={user} {...props} />
} />
+ <Route exact path="/_fblogin" render={(props) => {
+ let params = qs.parse(props.location.search)
+ this.auth(params.hash)
+ return <Redirect to="/" />
+ }} />
<Route exact path="/post" render={(props) => <Post visitor={user} {...props} />} />
<Route exact path="/pm" render={(props) => <Contacts visitor={user} {...props} />} />
<Route exact path="/pm/:user" render={(props) => <Chat visitor={user} {...props} />} />