-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
75 lines (64 loc) · 2.48 KB
/
index.html
File metadata and controls
75 lines (64 loc) · 2.48 KB
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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Mockflix — Sign In</title>
<link rel="stylesheet" href="styles.css" />
</head>
<body>
<div class="container">
<section class="hero">
<h1 class="h-title">Sign in to Mockflix</h1>
<p class="h-sub">Manage your membership, billing, and preferences.</p>
</section>
<div class="card panel loading-wrap" id="page">
<div class="spinner"><div class="spin" aria-label="Loading"></div></div>
<div class="content">
<form class="form" id="loginForm">
<div>
<label for="email">Email</label>
<input id="email" type="email" autocomplete="email" placeholder="you@example.com"
data-testid="login-email" required />
</div>
<div>
<label for="pw">Password</label>
<input id="pw" type="password" autocomplete="current-password" placeholder="••••••••"
data-testid="login-password" required />
</div>
<div class="footer-actions">
<span class="small muted left">Any credentials work. This is a mock environment.</span>
<button class="btn" type="submit" data-testid="login-submit">Sign In</button>
</div>
<div class="hr"></div>
</form>
</div>
</div>
</div>
<script src="app.js"></script>
<script>
const s = Mockflix.loadState();
if (s.loggedIn) window.location.href = "browse.html";
const page = document.getElementById("page");
Mockflix.setLoading("page");
Mockflix.realisticDelay().then(() => Mockflix.clearLoading("page"));
document.getElementById("loginForm").addEventListener("submit", async (e) => {
e.preventDefault();
const btn = e.submitter;
Mockflix.disableBriefly(btn);
Mockflix.setLoading("page");
await Mockflix.realisticDelay();
// Initialize state on login
Mockflix.setState({
loggedIn: true,
// keep existing state if already present; don't overwrite if user customized
});
// ensure state exists
const next = Mockflix.loadState();
if (!next.subscriptionStatus) Mockflix.setState({ subscriptionStatus: "active" });
if (!next.billingProvider) Mockflix.setState({ billingProvider: "direct" });
window.location.href = "browse.html" + (Mockflix.isTestMode() ? "?test=1" : "");
});
</script>
</body>
</html>