From 2e4dfb33b688b14f20ca50d2a58b56802a447ec8 Mon Sep 17 00:00:00 2001 From: Mathias Biilmann Christensen Date: Wed, 6 Sep 2017 17:58:32 -0700 Subject: [PATCH] Add explicit sign in button for netlify identity --- package.json | 2 +- .../git-gateway/AuthenticationPage.js | 26 ++++++++++++++----- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index faa3058c..26f62f49 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "netlify-cms", - "version": "0.5.0-beta.5", + "version": "0.5.0-beta.7", "description": "Netlify CMS lets content editors work on structured content stored in git", "main": "dist/cms.js", "scripts": { diff --git a/src/backends/git-gateway/AuthenticationPage.js b/src/backends/git-gateway/AuthenticationPage.js index 3fee915c..c6a5dc00 100644 --- a/src/backends/git-gateway/AuthenticationPage.js +++ b/src/backends/git-gateway/AuthenticationPage.js @@ -1,6 +1,8 @@ import React from "react"; import Input from "react-toolbox/lib/input"; import Button from "react-toolbox/lib/button"; +import { Notifs } from 'redux-notifications'; +import { Toast } from '../../components/UI/index'; import { Card, Icon } from "../../components/UI"; import logo from "./netlify_logo.svg"; import styles from "./AuthenticationPage.css"; @@ -19,15 +21,13 @@ if (window.netlifyIdentity) { export default class AuthenticationPage extends React.Component { constructor(props) { super(props); + component = this; } componentDidMount() { - component = this; if (!this.loggedIn && window.netlifyIdentity && window.netlifyIdentity.currentUser()) { this.props.onLogin(window.netlifyIdentity.currentUser()); - } - if (window.netlifyIdentity && !window.netlifyIdentity.currentUser()) { - window.netlifyIdentity.open('login'); + window.netlifyIdentity.close(); } } @@ -36,7 +36,6 @@ export default class AuthenticationPage extends React.Component { } handleIdentityLogin = (user) => { - console.log('logging in ', user); this.props.onLogin(user); window.netlifyIdentity.close(); } @@ -45,6 +44,14 @@ export default class AuthenticationPage extends React.Component { window.netlifyIdentity.open(); } + handleIdentity = () => { + if (window.netlifyIdentity.currentUser()) { + this.props.onLogin(user); + } else { + window.netlifyIdentity.open(); + } + } + static propTypes = { onLogin: React.PropTypes.func.isRequired, }; @@ -64,7 +71,7 @@ export default class AuthenticationPage extends React.Component { errors.email = 'Make sure to enter your user name'; } if (!password) { - errors.password = 'Please enter your password.'; + errors.password = 'Please enter your password'; } if (Object.keys(errors).length > 0) { @@ -86,7 +93,12 @@ export default class AuthenticationPage extends React.Component { const { error } = this.props; if (window.netlifyIdentity) { - return null; + return
+ + +
} return (