mail regex removed

This commit is contained in:
2024-06-10 11:08:01 +01:00
parent f8a2d44443
commit da05499a12
5 changed files with 19 additions and 41 deletions
@@ -16,7 +16,7 @@ const MyRepresentations = (props) => {
<div className="card" id="my-representations-card">
<div className="card-body">
<h3 className="heading-small card-heading">
{t("myportal:myrepresentations-card-title")}dd
{t("myportal:myrepresentations-card-title")}
</h3>
<div className="cardModuleContainer">
<TopThree
+6 -3
View File
@@ -109,7 +109,7 @@ const TopThree = (props) => {
const deleteRepItem = (containerID, caseID, repfile) => {
let cookies = parseCookies();
console.log("sssss", containerID, caseID, repfile);
//console.log("sssss", containerID, caseID, repfile);
deleteMyRepresentationsFromBlob(containerID, caseID, repfile)
.then((data) => {
@@ -209,11 +209,14 @@ const TopThree = (props) => {
<div className="cardModuleItem" key={index}>
<div className="cardModuleDetails">
<div className="cardModuleReference">
<b>{t("myportal:case-reference")}:</b>{" "}
<b>{t("myportal:case-reference")}:</b>
<Link
// href="#"
href={{
pathname: "/myportal/representation",
pathname:
router.locale == "cy"
? "/fymhorth/representation"
: "/myportal/representation",
query: {
case: showTopThreeArr[key].caseRef,
state: "edit",
+8
View File
@@ -151,6 +151,10 @@ module.exports = {
source: "/fymhorth/achos/id/:slug",
destination: "/myportal/case/id/:slug",
},
{
source: "/fymhorth/achos/:slug",
destination: "/myportal/case/:slug",
},
{
source: "/fymhorth/gweldpopeth",
destination: "/myportal/viewall",
@@ -159,6 +163,10 @@ module.exports = {
source: "/fymhorth/:slug",
destination: "/myportal/:slug",
},
{
source: "/fymhorth/cynrychiolaeth",
destination: "/myportal/representation",
},
{
source: "/allgofnodi",
destination: "/logout",
+3 -36
View File
@@ -24,18 +24,11 @@ const SignIn = (props) => {
"/api/auth/signin/email";
const [buttonDisabled, setButtonDisabled] = useState(false);
const [hasError, setHasError] = useState(false);
const emailRegex =
/(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/gi;
const handleSubmit = async (event) => {
event.preventDefault();
//!emailRegex.test(event.currentTarget[2].value) && setHasError(true);
!emailRegex.test(event.currentTarget[2].value)
? (setHasError(true), setButtonDisabled(true))
: (setButtonDisabled(true), event.target.submit());
setButtonDisabled(true);
event.target.submit();
};
return (
@@ -67,13 +60,7 @@ const SignIn = (props) => {
action="/api/auth/signin/email"
onSubmit={handleSubmit}
>
<div
className={
hasError
? "govuk-form-group govuk-form-group--error"
: "govuk-form-group "
}
>
<div className={"govuk-form-group "}>
<input
className="govuk-input"
name="csrfToken"
@@ -93,32 +80,12 @@ const SignIn = (props) => {
>
{t("auth:auth-email-label")}
</label>
{hasError && (
<span
id={"email-error"}
className="govuk-error-message"
>
<span className="govuk-visually-hidden">
Error:
</span>{" "}
Enter a valid email address
</span>
)}
<input
className="govuk-input govuk-!-width-three-quarters"
type="email"
id="email"
name="email"
onBlur={(e) => {
!emailRegex.test(
e.currentTarget.value
)
? (setHasError(true),
setButtonDisabled(true))
: (setHasError(false),
setButtonDisabled(false));
}}
/>
</div>
<div className="govuk-form-group">
+1 -1
View File
@@ -119,7 +119,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
const watchedCases = await getWatchedCases(loggedInUser);
console.log("sssss", loggedInUser);
//console.log("sssss", loggedInUser);
const [accountDetails, searchDetailsObj, watchedCasesDetails] =
await Promise.all([