This repository was archived by the owner on Feb 6, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathLogin.js
More file actions
108 lines (101 loc) · 3.09 KB
/
Copy pathLogin.js
File metadata and controls
108 lines (101 loc) · 3.09 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
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
105
106
107
108
import React from 'react';
import PropTypes from 'prop-types';
const Login = ({ handleLogin, message, forgotPasswordLink, loginLink }) => {
const handleSubmit = e => {
e.preventDefault();
handleLogin(username.value, password.value);
};
let username, password;
return (
<div className={'block block-customer-login'}>
<div
className="block-content"
aria-labelledby="block-customer-login-heading"
>
{message.text !== '' && (
<div className={`message ${message.type}`}>
<p>{message.text}</p>
</div>
)}
<form
className="form form-login"
onSubmit={handleSubmit}
action={loginLink}
method={'post'}
>
<fieldset className="fieldset login">
<div className="field note">
If you have an account, sign in with your email address.
</div>
<div className="field email required">
<label className="label" htmlFor="email">
<span>Email</span>
</label>
<div className="control">
<input
name="login[username]"
defaultValue={''}
id="email"
type="email"
className="input-text"
title="Email"
aria-required="true"
ref={ref => (username = ref)}
/>
</div>
</div>
<div className="field password required">
<label htmlFor="pass" className="label">
<span>Password</span>
</label>
<div className="control">
<input
name="login[password]"
defaultValue={''}
type="password"
className="input-text"
id="pass"
title="Password"
aria-required="true"
ref={ref => (password = ref)}
/>
</div>
</div>
<div className="actions-toolbar">
<div className="primary">
<button
type="submit"
className="action login primary"
name="send"
id="send2"
>
<span>Sign In</span>
</button>
</div>
<div className="secondary">
<a className="action remind" href={forgotPasswordLink}>
<span>Forgot Your Password?</span>
</a>
</div>
</div>
</fieldset>
</form>
</div>
</div>
);
};
Login.propTypes = {
handleLogin: PropTypes.func.isRequired,
message: PropTypes.object.isRequired,
loginLink: PropTypes.string.isRequired,
forgottenPasswordLink: PropTypes.string.isRequired
};
Login.defaultProps = {
handleLogin: () => {
console.log('handleLogin is not defined');
},
message: { type: '', text: '' },
loginLink: '',
forgottenPasswordLink: ''
};
export default Login;