All files / owid-grapher/adminSiteServer LoginPage.tsx

4.35% Statements 3/69
100% Branches 0/0
0% Functions 0/1
4.35% Lines 3/69

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 781x 1x 1x                                                                                                                                                      
import * as React from "react"
 
export const LoginPage = (props: { next?: string; errorMessage?: string }) => {
    const style = `
        html, body {
            height: 100%;
        }

        body {
            display: flex;
            align-items: center;
            justify-content: center;
        }

        h1 {
            margin-bottom: 0.4em;
        }

        button {
            cursor: pointer;
        }
    `
    return (
        <html lang="en">
            <head>
                <title>owid-admin</title>
                <meta name="description" content="" />
                <link
                    rel="stylesheet"
                    href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css"
                />
                <style>{style}</style>
            </head>
            <body>
                <form method="POST">
                    <h1>owid-admin</h1>
                    <div className="form-group">
                        <label>Email address</label>
                        <input
                            name="username"
                            type="email"
                            className="form-control"
                            placeholder="Enter email"
                            required
                        />
                    </div>
                    <div className="form-group">
                        <label>Password</label>
                        <input
                            name="password"
                            type="password"
                            className="form-control"
                            placeholder="Password"
                            required
                        />
                    </div>
                    <input type="hidden" name="next" value={props.next} />
                    {props.errorMessage && (
                        <div className="alert alert-danger">
                            {props.errorMessage}
                        </div>
                    )}
                    <p>
                        Having trouble logging in? Go to{" "}
                        <a href="https://owid.slack.com/messages/tech-issues/">
                            #tech-issues
                        </a>
                        .
                    </p>
                    <button type="submit" className="btn btn-primary">
                        Login
                    </button>
                </form>
            </body>
        </html>
    )
}