mail regex removed
This commit is contained in:
@@ -16,7 +16,7 @@ const MyRepresentations = (props) => {
|
|||||||
<div className="card" id="my-representations-card">
|
<div className="card" id="my-representations-card">
|
||||||
<div className="card-body">
|
<div className="card-body">
|
||||||
<h3 className="heading-small card-heading">
|
<h3 className="heading-small card-heading">
|
||||||
{t("myportal:myrepresentations-card-title")}dd
|
{t("myportal:myrepresentations-card-title")}
|
||||||
</h3>
|
</h3>
|
||||||
<div className="cardModuleContainer">
|
<div className="cardModuleContainer">
|
||||||
<TopThree
|
<TopThree
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ const TopThree = (props) => {
|
|||||||
|
|
||||||
const deleteRepItem = (containerID, caseID, repfile) => {
|
const deleteRepItem = (containerID, caseID, repfile) => {
|
||||||
let cookies = parseCookies();
|
let cookies = parseCookies();
|
||||||
console.log("sssss", containerID, caseID, repfile);
|
//console.log("sssss", containerID, caseID, repfile);
|
||||||
|
|
||||||
deleteMyRepresentationsFromBlob(containerID, caseID, repfile)
|
deleteMyRepresentationsFromBlob(containerID, caseID, repfile)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
@@ -209,11 +209,14 @@ const TopThree = (props) => {
|
|||||||
<div className="cardModuleItem" key={index}>
|
<div className="cardModuleItem" key={index}>
|
||||||
<div className="cardModuleDetails">
|
<div className="cardModuleDetails">
|
||||||
<div className="cardModuleReference">
|
<div className="cardModuleReference">
|
||||||
<b>{t("myportal:case-reference")}:</b>{" "}
|
<b>{t("myportal:case-reference")}:</b>
|
||||||
<Link
|
<Link
|
||||||
// href="#"
|
// href="#"
|
||||||
href={{
|
href={{
|
||||||
pathname: "/myportal/representation",
|
pathname:
|
||||||
|
router.locale == "cy"
|
||||||
|
? "/fymhorth/representation"
|
||||||
|
: "/myportal/representation",
|
||||||
query: {
|
query: {
|
||||||
case: showTopThreeArr[key].caseRef,
|
case: showTopThreeArr[key].caseRef,
|
||||||
state: "edit",
|
state: "edit",
|
||||||
|
|||||||
@@ -151,6 +151,10 @@ module.exports = {
|
|||||||
source: "/fymhorth/achos/id/:slug",
|
source: "/fymhorth/achos/id/:slug",
|
||||||
destination: "/myportal/case/id/:slug",
|
destination: "/myportal/case/id/:slug",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
source: "/fymhorth/achos/:slug",
|
||||||
|
destination: "/myportal/case/:slug",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
source: "/fymhorth/gweldpopeth",
|
source: "/fymhorth/gweldpopeth",
|
||||||
destination: "/myportal/viewall",
|
destination: "/myportal/viewall",
|
||||||
@@ -159,6 +163,10 @@ module.exports = {
|
|||||||
source: "/fymhorth/:slug",
|
source: "/fymhorth/:slug",
|
||||||
destination: "/myportal/:slug",
|
destination: "/myportal/:slug",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
source: "/fymhorth/cynrychiolaeth",
|
||||||
|
destination: "/myportal/representation",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
source: "/allgofnodi",
|
source: "/allgofnodi",
|
||||||
destination: "/logout",
|
destination: "/logout",
|
||||||
|
|||||||
+3
-36
@@ -24,18 +24,11 @@ const SignIn = (props) => {
|
|||||||
"/api/auth/signin/email";
|
"/api/auth/signin/email";
|
||||||
|
|
||||||
const [buttonDisabled, setButtonDisabled] = useState(false);
|
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) => {
|
const handleSubmit = async (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
setButtonDisabled(true);
|
||||||
//!emailRegex.test(event.currentTarget[2].value) && setHasError(true);
|
event.target.submit();
|
||||||
|
|
||||||
!emailRegex.test(event.currentTarget[2].value)
|
|
||||||
? (setHasError(true), setButtonDisabled(true))
|
|
||||||
: (setButtonDisabled(true), event.target.submit());
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -67,13 +60,7 @@ const SignIn = (props) => {
|
|||||||
action="/api/auth/signin/email"
|
action="/api/auth/signin/email"
|
||||||
onSubmit={handleSubmit}
|
onSubmit={handleSubmit}
|
||||||
>
|
>
|
||||||
<div
|
<div className={"govuk-form-group "}>
|
||||||
className={
|
|
||||||
hasError
|
|
||||||
? "govuk-form-group govuk-form-group--error"
|
|
||||||
: "govuk-form-group "
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<input
|
<input
|
||||||
className="govuk-input"
|
className="govuk-input"
|
||||||
name="csrfToken"
|
name="csrfToken"
|
||||||
@@ -93,32 +80,12 @@ const SignIn = (props) => {
|
|||||||
>
|
>
|
||||||
{t("auth:auth-email-label")}
|
{t("auth:auth-email-label")}
|
||||||
</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
|
<input
|
||||||
className="govuk-input govuk-!-width-three-quarters"
|
className="govuk-input govuk-!-width-three-quarters"
|
||||||
type="email"
|
type="email"
|
||||||
id="email"
|
id="email"
|
||||||
name="email"
|
name="email"
|
||||||
onBlur={(e) => {
|
|
||||||
!emailRegex.test(
|
|
||||||
e.currentTarget.value
|
|
||||||
)
|
|
||||||
? (setHasError(true),
|
|
||||||
setButtonDisabled(true))
|
|
||||||
: (setHasError(false),
|
|
||||||
setButtonDisabled(false));
|
|
||||||
}}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-form-group">
|
<div className="govuk-form-group">
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
|
|
||||||
const watchedCases = await getWatchedCases(loggedInUser);
|
const watchedCases = await getWatchedCases(loggedInUser);
|
||||||
|
|
||||||
console.log("sssss", loggedInUser);
|
//console.log("sssss", loggedInUser);
|
||||||
|
|
||||||
const [accountDetails, searchDetailsObj, watchedCasesDetails] =
|
const [accountDetails, searchDetailsObj, watchedCasesDetails] =
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
|||||||
Reference in New Issue
Block a user