Skip to content

Commit f71e96e

Browse files
committed
Refactor configuration handling and enhance password requirements component; update Nginx configuration and remove deprecated files
1 parent 9755b19 commit f71e96e

File tree

12 files changed

+409
-314
lines changed

12 files changed

+409
-314
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ instance/
1414
iso/
1515
logs/
1616
migrations/
17-
nginx.conf
1817
node_modules/
1918
npm-debug.log*
2019
.pnp

client/src/components/FooterComponent.tsx

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,13 @@ const FooterComponent: FC = (): ReactElement => {
5050
.
5151
</p>
5252
<p>
53-
Originally developed as part of a dissertation project for{" "}
53+
Initially created for a dissertation project at{" "}
5454
<a href="https://www.hw.ac.uk/uk/schools/mathematical-computer-sciences.htm">
5555
Heriot-Watt University&apos;s School of Mathematical and
5656
Computer Sciences
5757
</a>
5858
.
5959
</p>
60-
<p>
61-
Logos courtesy of{" "}
62-
<a href="https://commons.wikimedia.org/wiki/Main_Page">
63-
Wikimedia Commons
64-
</a>
65-
. Respective owners retain all rights, unless otherwise stated.
66-
</p>
6760
</Col>
6861
</Row>
6962
</Container>
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
* PasswordRequirementsComponent.tsx - Display password requirements for a password input.
3+
* Copyright (C) 2024, Kieran Gordon
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU Affero General Public License as
7+
* published by the Free Software Foundation, either version 3 of the
8+
* License, or (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU Affero General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU Affero General Public License
16+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
17+
*/
18+
19+
import React from 'react';
20+
21+
interface PasswordRequirementsProps {
22+
password: string;
23+
}
24+
25+
const PasswordRequirementsComponent: React.FC<PasswordRequirementsProps> = ({ password }) => {
26+
const requirements = [
27+
{ regex: /.{8,}/, label: 'At least 8 characters' },
28+
{ regex: /[A-Z]/, label: 'At least 1 uppercase letter' },
29+
{ regex: /[a-z]/, label: 'At least 1 lowercase letter' },
30+
{ regex: /[0-9].*[0-9]/, label: 'At least 2 digits' },
31+
{ regex: /[!@#$%^&*(),.?":{}|<>]/, label: 'At least 1 symbol' },
32+
{ regex: /^\S*$/, label: 'No spaces' },
33+
];
34+
35+
return (
36+
<ul>
37+
{requirements.map((requirement, index) => (
38+
<li
39+
key={index}
40+
style={{
41+
color: requirement.regex.test(password) ? 'green' : 'red',
42+
}}
43+
>
44+
{requirement.label}
45+
</li>
46+
))}
47+
</ul>
48+
);
49+
};
50+
51+
export default PasswordRequirementsComponent;

0 commit comments

Comments
 (0)