aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/components/LoginButton.js
diff options
context:
space:
mode:
Diffstat (limited to 'vnext/src/components/LoginButton.js')
-rw-r--r--vnext/src/components/LoginButton.js32
1 files changed, 24 insertions, 8 deletions
diff --git a/vnext/src/components/LoginButton.js b/vnext/src/components/LoginButton.js
index f35a932d..c332de14 100644
--- a/vnext/src/components/LoginButton.js
+++ b/vnext/src/components/LoginButton.js
@@ -1,24 +1,40 @@
import React from 'react';
import PropTypes from 'prop-types';
import Icon from './Icon';
+import Modal from './Modal';
export default class LoginButton extends React.Component {
constructor(props) {
super(props);
- window.addEventListener('message', (event) => {
- this.props.onAuth(event.data);
- }, false);
+ this.state = { isOpen: false };
}
- login(event) {
- event.preventDefault();
- let loginWindow = window.open('https://juick.com/login?redirect=false', 'Login to Juick', 'width=400,height=300,resizeable=no,menubar=no,toolbar=no,scrollbars=no');
- loginWindow.window.focus();
+ toggleModal(event) {
+ event.preventDefault()
+ this.setState({
+ isOpen: !this.state.isOpen
+ });
}
render() {
return (
- <a href="/login" onClick={this.login}><Icon name="ei-user" size="s"/>{this.props.title}</a>
+ <React.Fragment>
+ <a onClick={this.toggleModal.bind(this)}><Icon name="ei-user" size="s" />{this.props.title}</a>
+ <Modal show={this.state.isOpen}
+ onClose={this.toggleModal.bind(this)}>
+ <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="/_vklogin" id="signvk"><Icon name="ei-sc-vk" size="s" />Login with VK</a>
+ <p>Already registered?</p>
+ <form action="/login" method="POST">
+ <input className="signinput" type="text" name="username" placeholder="Username..." /><br />
+ <input className="signinput" type="password" name="password" placeholder="Password..." /><br />
+ <input className="signsubmit" type="submit" value="OK" />
+ </form>
+ </div>
+ </Modal>
+ </React.Fragment>
);
}
}