Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New login screen #1331

Merged
merged 15 commits into from
Jul 10, 2020
Prev Previous commit
Next Next commit
cleanup
  • Loading branch information
tommoor committed Jul 4, 2020
commit 35acb00a3ffad82afb2b0babdab51b22c7dc143d
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type Props = {
notice?: string,
};

export default function AuthNotices({ notice }: Props) {
export default function Notices({ notice }: Props) {
return (
<React.Fragment>
{notice === "google-hd" && (
Expand Down
20 changes: 8 additions & 12 deletions app/scenes/Login/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import ButtonLarge from "components/ButtonLarge";
import HelpText from "components/HelpText";
import Fade from "components/Fade";
import Service from "./Service";
import AuthNotices from "./AuthNotices";
import Notices from "./Notices";
import AuthStore from "stores/AuthStore";
import getQueryVariable from "shared/utils/getQueryVariable";

Expand All @@ -24,21 +24,21 @@ type Props = {
};

type State = {
signinLinkSent: string,
emailLinkSentTo: string,
};

@observer
class Login extends React.Component<Props, State> {
state = {
signinLinkSent: "",
emailLinkSentTo: "",
};

handleReset = () => {
this.setState({ signinLinkSent: "" });
this.setState({ emailLinkSentTo: "" });
};

handleEmailSuccess = email => {
this.setState({ signinLinkSent: email });
this.setState({ emailLinkSentTo: email });
};

render() {
Expand Down Expand Up @@ -83,7 +83,7 @@ class Login extends React.Component<Props, State> {
</Back>
));

if (this.state.signinLinkSent) {
if (this.state.emailLinkSentTo) {
return (
<Background>
{header}
Expand All @@ -94,7 +94,7 @@ class Login extends React.Component<Props, State> {
<Heading>Check your email</Heading>
<Note>
A magic sign-in link has been sent to the email{" "}
<em>{this.state.signinLinkSent}</em>, no password needed.
<em>{this.state.emailLinkSentTo}</em>, no password needed.
</Note>
<br />
<ButtonLarge onClick={this.handleReset} fullwidth neutral>
Expand All @@ -105,23 +105,20 @@ class Login extends React.Component<Props, State> {
);
}

console.log(getQueryVariable("notice"));

return (
<Background>
{header}
<Centered align="center" justify="center" column auto>
<PageTitle title="Login" />
{logo}

{/* TODO: Auth notices */}
{isCreate ? (
<Heading>Create an account</Heading>
) : (
<Heading>Login to {config.name || "Outline"}</Heading>
)}

<AuthNotices notice={getQueryVariable("notice")} />
<Notices notice={getQueryVariable("notice")} />

{defaultService && (
<React.Fragment key={defaultService.id}>
Expand All @@ -141,7 +138,6 @@ class Login extends React.Component<Props, State> {
</React.Fragment>
)}

{/* TODO: Email login */}
{config.services.map(service => {
if (service.id === auth.lastSignedIn) {
return null;
Expand Down