Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: flesh in signup form #831

Merged
merged 1 commit into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions clients/admin-client/src/components/SignupForm.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { FC, useState } from "react";
import { FontAwesomeIcon, faArrowRight, TextField, Button } from '@cats-cradle/design-system/dist/main';
import React from 'react';

type TSignupForm = {
title?: string;
};

export const SignupForm: FC<TSignupForm> = ({ title }) => {
const [isLoading, setIsLoading] = useState<boolean>(false);
const [email, setEmail] = useState<string>('');
const [password, setPassword] = useState<string>('');

async function createUser() {
// Now use the email and password states here
console.log("Email:", email);
console.log("Password:", password);

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information High

This logs sensitive data returned by
an access to password
as clear text.
// await axios.post()
// set isLoading
}

function onClickHandler(event: React.MouseEvent) {
setIsLoading(true);
createUser(); // Call createUser when the button is clicked
console.log(event);
return;
}

return (
<div>
<h2>Create an account</h2>
<div className="mb-3">
{/* Bind the value and onChange to the email state */}
<TextField id="email-address" label="Email Address" type="text" value={email} onChange={(e) => setEmail(e.target.value)} />
</div>
<div className="mb-3">
{/* Bind the value and onChange to the password state */}
<TextField id="password" label="Password" type="password" value={password} onChange={(e) => setPassword(e.target.value)} />
</div>
<div className="mb-3">
<Button loading={isLoading} onClick={onClickHandler} color="primary">
Create Account <FontAwesomeIcon icon={faArrowRight} />
</Button>
</div>
</div>
);
};
19 changes: 2 additions & 17 deletions clients/admin-client/src/pages/signup.page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { Paper, Link, Button, TextField, faArrowRight, FontAwesomeIcon } from '@cats-cradle/design-system/dist/main';
import React from 'react';
import { SignupForm } from '../components/SignupForm';

export default function SignupPage() {
function onClickHandler(event: React.MouseEvent){
console.log(event);
return;
}

return (
<main className="container">
Expand All @@ -21,18 +17,7 @@ export default function SignupPage() {
</div>
<div className='col-lg-6 col-sm-12 order-last'>
<Paper elevation="1" className='p-5'>
<div>
<h2>Create an account</h2>
<div className="mb-3">
<TextField id="email-address" label="Email Address" type="text"/>
</div>
<div className="mb-3">
<TextField id="password" label="Password" type="password"/>
</div>
<div className="mb-3">
<Button onClick={onClickHandler} color="primary">Create Account <FontAwesomeIcon icon={faArrowRight}/></Button>
</div>
</div>
<SignupForm/>
</Paper>
</div>
</div>
Expand Down
Loading