-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support basic authentication on frontend
- Loading branch information
Showing
8 changed files
with
135 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
REACT_APP_API_URL=http://localhost:8000 | ||
REACT_APP_API_URL=http://localhost:8000 | ||
REACT_APP_REQUIRE_BASIC_AUTH= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import React, { useState } from 'react'; | ||
import './LoginStyles.css'; | ||
|
||
const Login = ({ onLogin }) => { | ||
const [username, setUsername] = useState(''); | ||
const [password, setPassword] = useState(''); | ||
|
||
const handleSubmit = (e) => { | ||
e.preventDefault(); | ||
onLogin(username, password); | ||
}; | ||
|
||
return ( | ||
<div className="loginContainer"> | ||
<form onSubmit={handleSubmit} className="formStyle"> | ||
<input | ||
type="text" | ||
value={username} | ||
onChange={(e) => setUsername(e.target.value)} | ||
placeholder="Username" | ||
className="inputStyle" | ||
/> | ||
<input | ||
type="password" | ||
value={password} | ||
onChange={(e) => setPassword(e.target.value)} | ||
placeholder="Password" | ||
className="inputStyle" | ||
/> | ||
<button type="submit" className="buttonStyle">Login</button> | ||
</form> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Login; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* LoginStyles.css - Ensuring form elements alignment */ | ||
|
||
.loginContainer { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
height: 100vh; | ||
background-color: #f0f0f0; | ||
} | ||
|
||
.formStyle { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
padding: 20px; | ||
border-radius: 5px; | ||
box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.2); | ||
background-color: white; | ||
} | ||
|
||
.inputStyle, .buttonStyle { | ||
margin: 10px 0; /* Consistent vertical margin */ | ||
padding: 8px; | ||
width: 300px; /* Adjust width as needed */ | ||
display: block; /* Block level for consistent alignment */ | ||
box-sizing: border-box; /* Include padding and border in width/height */ | ||
} | ||
|
||
.inputStyle { | ||
border: 1px solid rgba(0, 0, 0, 0.1); | ||
} | ||
|
||
.buttonStyle { | ||
padding: 8px 15px; | ||
background-color: #4CAF50; | ||
color: white; | ||
border: none; | ||
cursor: pointer; | ||
width: 320px; /* Slightly larger than input for better visual */ | ||
margin-top: 20px; /* Increased top margin for separation from inputs */ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,7 +67,6 @@ form { | |
|
||
form input[type="text"] { | ||
padding: 8px; | ||
margin-right: 10px; | ||
} | ||
|
||
form button { | ||
|