This repository has been archived by the owner on Apr 18, 2023. It is now read-only.
/
loginForm.jsx
81 lines (77 loc) · 2.24 KB
/
loginForm.jsx
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
import React, { useState } from "react";
import styles from "../styles.module.scss";
import TextInput from "../../../components/TextInput";
import Button from "../../../components/Button";
import open from "open";
const appVersion = window.require("electron").remote.app.getVersion();
export default function LoginForm({ handleLogin, credError }) {
const [username, setUsername] = useState("");
const [password, setPassword] = useState("");
const handleSubmit = (e) => {
e.preventDefault();
handleLogin({ username, password });
};
const openLinkInBrowser = (link) => {
open(link);
};
return (
<form className={styles.contents} onSubmit={handleSubmit}>
<h4 className={styles.formTitle}>Login to your IG Account</h4>
{credError ? (
<span className={styles.error}>
{credError === true ? "Invalid username or password" : credError}
</span>
) : (
<></>
)}
<TextInput
placeholder="Username"
value={username}
onChange={(e) => setUsername(e.target.value)}
/>
<TextInput
type="password"
value={password}
onChange={(e) => setPassword(e.target.value)}
placeholder="Password"
/>
<Button
onClick={() => {
handleLogin({ username, password });
}}
type="submit"
>
Login
</Button>
<div className={styles.statusTexts}>
<p className={styles.status}>Streamon {appVersion}</p>
<p className={styles.author}>
⚠️ Please read our
<span
className={styles.link}
onClick={() => openLinkInBrowser("https://getstreamon.com/terms")}
>
ToS and Privacy Policy
</span>
</p>
<p className={styles.links}>
<span
className={styles.link}
onClick={() =>
openLinkInBrowser("https://getstreamon.com/downloads")
}
>
🌀 Updates
</span>{" "}
•
<span
className={styles.link}
onClick={() => openLinkInBrowser("https://ko-fi.com/haxzie")}
>
💸 Donate
</span>
</p>
</div>
</form>
);
}