static-cms/src/backends/test-repo/AuthenticationPage.js
Mathias Biilmann Christensen aaa9d2ab95 Make Neltify CMS work with Netlify Identity Widget
When Netlify CMS uses the git-gateway backend, it will check for a

  window.netlifyIdentity

object and use that to handle the whole auth flow.

This also sets defaults for the git-gateway endpoint, that means it
can be used in templates with zero configuration and fit with a
one-click deploy to Netlify approach.

Netlify Identity itself is based on our open-source GoTrue microservice,
and Netlify's Git Gateway project is completely open-source as well.

The git-gateway backend will work with Netlify without any setup, but can
also be configured to work with any selfhosted GoTrue and Git Gateway
instances.
2017-09-06 13:52:11 -07:00

47 lines
1.2 KiB
JavaScript

import React from 'react';
import Input from "react-toolbox/lib/input";
import Button from "react-toolbox/lib/button";
import { Card, Icon } from "../../components/UI";
import logo from "../git-gateway/netlify_logo.svg";
import styles from "../git-gateway/AuthenticationPage.css";
export default class AuthenticationPage extends React.Component {
static propTypes = {
onLogin: React.PropTypes.func.isRequired,
};
state = { email: '' };
handleLogin = (e) => {
e.preventDefault();
this.props.onLogin(this.state);
};
handleEmailChange = (value) => {
this.setState({ email: value });
};
render() {
return (<section className={styles.root}>
<Card className={styles.card}>
<img src={logo} width={100} role="presentation" />
<p className={styles.message}>This is a demo, enter your email to start</p>
<Input
type="text"
label="Email"
name="email"
value={this.state.email}
onChange={this.handleEmailChange}
/>
<Button
className={styles.button}
raised
onClick={this.handleLogin}
>
<Icon type="login" /> Login
</Button>
</Card>
</section>);
}
}