All files / owid-grapher/adminSiteServer RegisterPage.tsx

3.95% Statements 3/76
100% Branches 0/0
0% Functions 0/1
3.95% Lines 3/76

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 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 1051x 1x 1x                                                                                                                                                                                                            
import * as React from "react"
 
export const RegisterPage = (props: {
    inviteEmail?: string
    errorMessage?: string
    body: any
}) => {
    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>
                    <p>
                        Register an account to access the{" "}
                        <a href="https://ourworldindata.org">
                            ourworldindata.org
                        </a>{" "}
                        database and chart editor.
                    </p>
                    <div className="form-group">
                        <label>Email</label>
                        <input
                            name="email"
                            type="email"
                            className="form-control"
                            placeholder="Email"
                            required
                            value={props.body.email || props.inviteEmail}
                        />
                    </div>
                    <div className="form-group">
                        <label>Name</label>
                        <input
                            name="fullName"
                            className="form-control"
                            placeholder="Full name"
                            required
                            value={props.body.fullName}
                        />
                    </div>
                    <div className="form-group">
                        <label>Password</label>
                        <input
                            name="password"
                            type="password"
                            className="form-control"
                            placeholder="Password"
                            required
                            value={props.body.password}
                        />
                    </div>
                    <div className="form-group">
                        <label>Confirm Password</label>
                        <input
                            name="confirmPassword"
                            type="password"
                            className="form-control"
                            placeholder="Password"
                            required
                            value={props.body.confirmPassword}
                        />
                    </div>
                    <input type="hidden" name="code" value={props.body.code} />
                    {props.errorMessage && (
                        <div className="alert alert-danger">
                            {props.errorMessage}
                        </div>
                    )}
                    <button type="submit" className="btn btn-primary">
                        Register
                    </button>
                </form>
            </body>
        </html>
    )
}