Skip to content
This repository has been archived by the owner on Sep 29, 2024. It is now read-only.

Commit

Permalink
Merge pull request #917 from SE-TINF22B6/frontend
Browse files Browse the repository at this point in the history
Sign up: Fixed double tos and privacy policy consent and adapted error message styles
  • Loading branch information
maxschwinghammer authored Jun 10, 2024
2 parents 0e906ee + 19f0de5 commit 0a0b245
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 80 deletions.
3 changes: 1 addition & 2 deletions src/main/web/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
}

.error, .loading {

font-size: 24px;
font-weight: var(--strong-font-weight);
line-height: 24px;
Expand Down Expand Up @@ -90,7 +89,6 @@
justify-content: center;
position: relative;
margin-bottom: 20px;

text-decoration: none;
font-size: 20px;
}
Expand All @@ -117,6 +115,7 @@

.alert-danger {
color: var(--red);
font-weight: bold;
font-size: 14px;
margin-top: 10px;
margin-bottom: 10px;
Expand Down
32 changes: 7 additions & 25 deletions src/main/web/src/organisms/signup/EmailInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import "./EmailInput.css";
import { Formik, Field, Form, ErrorMessage } from "formik";
import * as Yup from "yup";
import {emailVerification, googleLogin} from "../../services/AuthService";
import ErrorModal from "./ErrorModal";
import {CredentialResponse, GoogleLogin} from "@react-oauth/google";
import {NavigateFunction, useNavigate} from "react-router-dom";

Expand Down Expand Up @@ -57,19 +56,15 @@ export const EmailInput = forwardRef<HTMLDivElement, { onSuccess: () => void }>(
onSuccess();
},
(error): void => {
let resMessage =
(error.response &&
error.response.data &&
error.response.data.message) ||
error.message ||
error.toString();
let resMessage = (error.response && error.response.data && error.response.data.message) || error.message || error.toString();

if (error.message === "Request failed with status code 400") {
setShowError(true);
}

setLoading(false);
setMessage(resMessage);
setContainerHeight("560px");
}
);
};
Expand Down Expand Up @@ -118,14 +113,7 @@ export const EmailInput = forwardRef<HTMLDivElement, { onSuccess: () => void }>(
/>
<form style={{color: 'var(--white)', fontSize: '14px'}}>
<fieldset style={{border: 'none'}}>
<input
type="checkbox"
id="mc"
name="Agree"
value="Agree"
className="consent-radio-button"
onChange={handleConsentChange}
/>
<input type="checkbox" id="mc" name="Agree" value="Agree" className="consent-radio-button" onChange={handleConsentChange}/>
<label htmlFor="mc">
I accept{" "}
<a className="consent-link" href='/terms-of-service' target="_blank" rel="noopener noreferrer">Terms of Service</a>{" "}
Expand All @@ -136,6 +124,9 @@ export const EmailInput = forwardRef<HTMLDivElement, { onSuccess: () => void }>(
</form>
{consentError && <div className="alert-danger">{consentError}</div>}
<ErrorMessage name="email" component="div" className="alert-danger"/>
{showError && !isInputFocused && (
<div className="alert-danger">{message}</div>
)}
</div>
<div className="form-group">
<button type="submit" className="loading-btn">
Expand All @@ -150,10 +141,7 @@ export const EmailInput = forwardRef<HTMLDivElement, { onSuccess: () => void }>(
<label className="signup-option-text">
Already have an account?{" "}
</label>
<label
className="signup-option-text-link"
onClick={handleOpenLogin}
>
<label className="signup-option-text-link" onClick={handleOpenLogin}>
LOGIN
</label>
</div>
Expand All @@ -173,12 +161,6 @@ export const EmailInput = forwardRef<HTMLDivElement, { onSuccess: () => void }>(
}}
/>
</div>

<div className="error-message-dialog">
{showError && !isInputFocused && (
<ErrorModal message={message} onClose={() => setShowError(false)} />
)}
</div>
</div>
);
});
Expand Down
6 changes: 0 additions & 6 deletions src/main/web/src/organisms/signup/ErrorModal.css

This file was deleted.

17 changes: 0 additions & 17 deletions src/main/web/src/organisms/signup/ErrorModal.tsx

This file was deleted.

17 changes: 0 additions & 17 deletions src/main/web/src/organisms/signup/ErrorUsernameModal.tsx

This file was deleted.

14 changes: 1 addition & 13 deletions src/main/web/src/organisms/signup/UsernamePasswordInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@ import React, { useState } from 'react';
import * as Yup from "yup";
import {register} from "../../services/AuthService";
import {ErrorMessage, Field, Form, Formik} from "formik";
import {Checkbox, FormControlLabel} from "@mui/material";
import {NavigateFunction, useNavigate} from "react-router-dom";
import './UsernamePasswordInput.css';
import ErrorUsernameModal from "./ErrorUsernameModal";

const UsernamePasswordInput = () => {
let navigate: NavigateFunction = useNavigate();

const [message, setMessage] = useState<string>("");
const [loading, setLoading] = useState<boolean>(false);
const [acceptPrivacyPolicy, setAcceptPrivacyPolicy] = useState(false);
const [showError, setShowError] = useState<boolean>(false);

const initialValues: {
Expand Down Expand Up @@ -86,15 +83,6 @@ const UsernamePasswordInput = () => {
<Field name="re-password" type="password" className="form-control"/>
<ErrorMessage name="re-password" component="div" className="alert-danger"/>
</div>
<div className="accept-privacy-policy">
<FormControlLabel
control={
<Checkbox className="checkbox" checked={acceptPrivacyPolicy}
onChange={(e) => setAcceptPrivacyPolicy(e.target.checked)}
/>}
label="I accept Terms of Service and Privacy Policy"
className="accept-privacy-policy-checkbox"/>
</div>
<div className="form-group">
<button type="submit" className="loading-btn">
{loading && (
Expand All @@ -111,7 +99,7 @@ const UsernamePasswordInput = () => {

<div className="error-message-dialog">
{showError && (
<ErrorUsernameModal message={message} onClose={() => setShowError(false)}/>
<div className="alert-danger">{message}</div>
)}
</div>
</Form>
Expand Down

0 comments on commit 0a0b245

Please sign in to comment.