Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 590293d561 |
@@ -9,5 +9,6 @@ REACT_APP_APPSITE=" https://myfitapp.mermsemr.com"
|
|||||||
|
|
||||||
REACT_APP_AUX_ENDPOINT = "https://devapi.mermsemr.com/en/desktop/api/v2/myfit"
|
REACT_APP_AUX_ENDPOINT = "https://devapi.mermsemr.com/en/desktop/api/v2/myfit"
|
||||||
REACT_APP_USERS_ENDPOINT = "https://devapi.mermsemr.com/en/desktop/api/v2/myfituser"
|
REACT_APP_USERS_ENDPOINT = "https://devapi.mermsemr.com/en/desktop/api/v2/myfituser"
|
||||||
|
# REACT_APP_PASSWORD_ENDPOINT = "https://devapi.mermsemr.com/en/desktop/api/v2/myfituser/resetpass"
|
||||||
|
|
||||||
REACT_APP_SESSION_EXPIRE_MINUTES = 5
|
REACT_APP_SESSION_EXPIRE_MINUTES = 5
|
||||||
@@ -1,10 +1,40 @@
|
|||||||
import React from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
import { Link } from 'react-router-dom';
|
import { Link, useNavigate } from 'react-router-dom';
|
||||||
import titleShape from "../../../assets/images/shape/title-shape-two.svg";
|
import titleShape from "../../../assets/images/shape/title-shape-two.svg";
|
||||||
import InputCom from "../../Helpers/Inputs/InputCom";
|
import InputCom from "../../Helpers/Inputs/InputCom";
|
||||||
import AuthLayout from "../AuthLayout";
|
import AuthLayout from "../AuthLayout";
|
||||||
|
|
||||||
export default function ForgotPassword() {
|
export default function ForgotPassword() {
|
||||||
|
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const [validation, setValidation] = useState("")
|
||||||
|
const [buttonDisabled, setButtonDisabled] = useState(true)
|
||||||
|
|
||||||
|
// email
|
||||||
|
const [email, setEmail] = useState("");
|
||||||
|
const handleEmail = (e) => {
|
||||||
|
setEmail(e.target.value);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
function validationChecker(email) {
|
||||||
|
const emailCheck = /^[^0-9][a-zA-Z0-9._%+-]+@[a-zA-Z]+(\.[a-zA-Z]+)+$/;
|
||||||
|
if (email === "") {
|
||||||
|
setValidation("email is required");
|
||||||
|
|
||||||
|
} else if (!email.match(emailCheck)) {
|
||||||
|
setValidation('Please input a valid email address');
|
||||||
|
|
||||||
|
} else {
|
||||||
|
setValidation("");
|
||||||
|
setButtonDisabled(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
validationChecker(email)
|
||||||
|
}, [email])
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<AuthLayout
|
<AuthLayout
|
||||||
@@ -28,19 +58,24 @@ export default function ForgotPassword() {
|
|||||||
name="email"
|
name="email"
|
||||||
type="email"
|
type="email"
|
||||||
iconName="message"
|
iconName="message"
|
||||||
|
inputHandler={handleEmail}
|
||||||
|
value={email}
|
||||||
/>
|
/>
|
||||||
|
{validation && <p className="my-5 font-bold text-red-500">{validation}</p>}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="signin-area mb-3.5">
|
<div className="signin-area mb-3.5">
|
||||||
<a
|
|
||||||
href="/verify-you"
|
<button
|
||||||
className="w-full rounded-[50px] mb-5 h-[58px] text-xl text-white font-bold flex justify-center bg-purple items-center"
|
className="w-full rounded-[50px] mb-5 h-[58px] text-xl text-white font-bold flex justify-center bg-purple items-center"
|
||||||
|
disabled={buttonDisabled}
|
||||||
|
onClick={() => navigate("/verify-you")}
|
||||||
>
|
>
|
||||||
Send Code
|
Send Code
|
||||||
</a>
|
</button>
|
||||||
|
|
||||||
|
|
||||||
<Link to="/"
|
<Link to="/"
|
||||||
className=" my-40 font-bold flex justify-center text-red-500 items-center"
|
className="my-40 font-bold flex justify-center text-red-500 items-center"
|
||||||
>
|
>
|
||||||
Back to Home
|
Back to Home
|
||||||
</Link>
|
</Link>
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ class usersService {
|
|||||||
return this.postAuxEnd("/login", reqData);
|
return this.postAuxEnd("/login", reqData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
getUserReminders(){
|
getUserReminders(){
|
||||||
return this.getAuxEnd("/reminders", null);
|
return this.getAuxEnd("/reminders", null);
|
||||||
}
|
}
|
||||||
@@ -55,14 +56,16 @@ class usersService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
postAuxEnd(uri, reqData) {
|
postAuxEnd(uri, reqData) {
|
||||||
const endPoint = process.env.REACT_APP_USERS_ENDPOINT + uri;
|
const endPoint = process.env.REACT_APP_USERS_ENDPOINT + uri;
|
||||||
const session_token = localStorage.getItem("session_token");
|
const token = '..your token..'
|
||||||
let axiosConfig = {
|
let axiosConfig = {
|
||||||
headers: {
|
headers: {
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
|
'Access-Control-Allow-Origin': '*',
|
||||||
'Content-Type': 'application/json;charset=UTF-8',
|
'Content-Type': 'application/json;charset=UTF-8',
|
||||||
'Authorization': `Basic ${session_token}`,
|
'Authorization': `Basic ${token}`,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
//Access-Control-Allow-Origin
|
//Access-Control-Allow-Origin
|
||||||
@@ -72,7 +75,7 @@ class usersService {
|
|||||||
};
|
};
|
||||||
// Axios.defaults.headers.post['Content-Type'] ='application/json;charset=utf-8';
|
// Axios.defaults.headers.post['Content-Type'] ='application/json;charset=utf-8';
|
||||||
// Axios.defaults.headers.post['Access-Control-Allow-Origin'] = '*'; //,axiosConfig
|
// Axios.defaults.headers.post['Access-Control-Allow-Origin'] = '*'; //,axiosConfig
|
||||||
return Axios.post(endPoint, reqData,axiosConfig)
|
return Axios.post(endPoint, reqData)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
// res = response;
|
// res = response;
|
||||||
|
|||||||
Reference in New Issue
Block a user