Skip to content

Commit

Permalink
Refactor configuration handling and enhance password requirements com…
Browse files Browse the repository at this point in the history
…ponent; update Nginx configuration and remove deprecated files
  • Loading branch information
kgdn committed Dec 17, 2024
1 parent 9755b19 commit f71e96e
Show file tree
Hide file tree
Showing 12 changed files with 409 additions and 314 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ instance/
iso/
logs/
migrations/
nginx.conf
node_modules/
npm-debug.log*
.pnp
Expand Down
9 changes: 1 addition & 8 deletions client/src/components/FooterComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,13 @@ const FooterComponent: FC = (): ReactElement => {
.
</p>
<p>
Originally developed as part of a dissertation project for{" "}
Initially created for a dissertation project at{" "}
<a href="https://www.hw.ac.uk/uk/schools/mathematical-computer-sciences.htm">
Heriot-Watt University&apos;s School of Mathematical and
Computer Sciences
</a>
.
</p>
<p>
Logos courtesy of{" "}
<a href="https://commons.wikimedia.org/wiki/Main_Page">
Wikimedia Commons
</a>
. Respective owners retain all rights, unless otherwise stated.
</p>
</Col>
</Row>
</Container>
Expand Down
51 changes: 51 additions & 0 deletions client/src/components/PasswordRequirementsComponent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* PasswordRequirementsComponent.tsx - Display password requirements for a password input.
* Copyright (C) 2024, Kieran Gordon
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import React from 'react';

interface PasswordRequirementsProps {
password: string;
}

const PasswordRequirementsComponent: React.FC<PasswordRequirementsProps> = ({ password }) => {
const requirements = [
{ regex: /.{8,}/, label: 'At least 8 characters' },
{ regex: /[A-Z]/, label: 'At least 1 uppercase letter' },
{ regex: /[a-z]/, label: 'At least 1 lowercase letter' },
{ regex: /[0-9].*[0-9]/, label: 'At least 2 digits' },
{ regex: /[!@#$%^&*(),.?":{}|<>]/, label: 'At least 1 symbol' },
{ regex: /^\S*$/, label: 'No spaces' },
];

return (
<ul>
{requirements.map((requirement, index) => (
<li
key={index}
style={{
color: requirement.regex.test(password) ? 'green' : 'red',
}}
>
{requirement.label}
</li>
))}
</ul>
);
};

export default PasswordRequirementsComponent;
Loading

0 comments on commit f71e96e

Please sign in to comment.