Selaa lähdekoodia

update send email with forgot password and layout fix

master
Alex Cheung 1 vuosi sitten
vanhempi
commit
21f153d063
14 muutettua tiedostoa jossa 46 lisäystä ja 48 poistoa
  1. +1
    -0
      src/components/I18nProvider.js
  2. +6
    -2
      src/components/RefreshTokenProvider.js
  3. +1
    -1
      src/layout/MainLayout/Header/HeaderContent/LocaleSelector.js
  4. +1
    -1
      src/pages/DemandNote/Search/index.js
  5. +1
    -1
      src/pages/Organization/SearchPage/index.js
  6. +1
    -1
      src/pages/Proof/Search_GLD/index.js
  7. +1
    -1
      src/pages/PublicNotice/ListPanel/index.js
  8. +1
    -1
      src/pages/PublicNotice/Search_GLD/index.js
  9. +1
    -1
      src/pages/User/DetailsPage_Organization/index.js
  10. +1
    -1
      src/pages/User/SearchPage_Organization/index.js
  11. +19
    -28
      src/pages/authentication/ForgotPassword/ForgotPasswordApplyForm.js
  12. +8
    -7
      src/pages/authentication/auth-forms/AuthLoginCustom.js
  13. +3
    -3
      src/pages/iAmSmart/AuthCallback/index.js
  14. +1
    -0
      src/utils/ApiPathConst.js

+ 1
- 0
src/components/I18nProvider.js Näytä tiedosto

@@ -26,6 +26,7 @@ export const I18nProvider = ({ children }) => {
setLocale(localStorage.getItem('locale')); setLocale(localStorage.getItem('locale'));
} }
}, []); }, []);
useEffect(() => { useEffect(() => {
// Load the messages for the selected locale // Load the messages for the selected locale
const fetchMessages = async () => { const fetchMessages = async () => {


+ 6
- 2
src/components/RefreshTokenProvider.js Näytä tiedosto

@@ -2,7 +2,9 @@ import { createContext, useEffect, useRef, useCallback } from 'react';
import { apiPath } from 'auth/utils'; import { apiPath } from 'auth/utils';
import { REFRESH_TOKEN } from 'utils/ApiPathConst'; import { REFRESH_TOKEN } from 'utils/ApiPathConst';
import axios from 'axios'; import axios from 'axios';

import {
isUserLoggedIn,
} from "utils/Utils";
const RefreshTokenContext = createContext(); const RefreshTokenContext = createContext();


const RefreshTokenProvider = ({ children }) => { const RefreshTokenProvider = ({ children }) => {
@@ -55,7 +57,9 @@ const RefreshTokenProvider = ({ children }) => {
// console.log('accessToken: ' + localStorage.getItem('accessToken')); // console.log('accessToken: ' + localStorage.getItem('accessToken'));
// console.log('refreshToken: ' + localStorage.getItem('refreshToken')); // console.log('refreshToken: ' + localStorage.getItem('refreshToken'));
if (currentTime >= expiryTime) { if (currentTime >= expiryTime) {
handleRefreshToken();
if(isUserLoggedIn()){
handleRefreshToken();
}
} }
} }
}, [token]); }, [token]);


+ 1
- 1
src/layout/MainLayout/Header/HeaderContent/LocaleSelector.js Näytä tiedosto

@@ -18,7 +18,7 @@ import Transitions from 'components/@extended/Transitions';
import LanguageIcon from '@mui/icons-material/Language'; import LanguageIcon from '@mui/icons-material/Language';
import {FormattedMessage} from "react-intl"; import {FormattedMessage} from "react-intl";
import * as React from "react"; import * as React from "react";
import LocaleContext from "../../../../components/I18nProvider";
import LocaleContext from "components/I18nProvider";


// ==============================|| HEADER CONTENT - NOTIFICATION ||============================== // // ==============================|| HEADER CONTENT - NOTIFICATION ||============================== //




+ 1
- 1
src/pages/DemandNote/Search/index.js Näytä tiedosto

@@ -98,7 +98,7 @@ const UserSearchPage_Individual = () => {
</Grid> </Grid>
</Grid> </Grid>
: :
<Grid container sx={{ backgroundColor: 'backgroundColor.default' }} direction="column">
<Grid container sx={{ minHeight: '95vh', backgroundColor: 'backgroundColor.default' }} direction="column">
<Grid item xs={12}> <Grid item xs={12}>
<div style={BackgroundHead}> <div style={BackgroundHead}>
<Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center">


+ 1
- 1
src/pages/Organization/SearchPage/index.js Näytä tiedosto

@@ -71,7 +71,7 @@ const OrganizationSearchPage = () => {
</Grid> </Grid>
</Grid> </Grid>
: :
<Grid container sx={{backgroundColor:"backgroundColor.default"}}>
<Grid container sx={{minHeight: '95vh', backgroundColor:"backgroundColor.default"}} direction="column">
<Grid item xs={12}> <Grid item xs={12}>
<div style={BackgroundHead}> <div style={BackgroundHead}>
<Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center">


+ 1
- 1
src/pages/Proof/Search_GLD/index.js Näytä tiedosto

@@ -96,7 +96,7 @@ const UserSearchPage_Individual = () => {
</Grid> </Grid>
</Grid> </Grid>
: :
<Grid container sx={{ backgroundColor: 'backgroundColor.default' }} direction="column"
<Grid container sx={{ minHeight: '95vh', backgroundColor: 'backgroundColor.default' }} direction="column"
> >
<Grid item xs={12}> <Grid item xs={12}>
<div style={BackgroundHead}> <div style={BackgroundHead}>


+ 1
- 1
src/pages/PublicNotice/ListPanel/index.js Näytä tiedosto

@@ -108,7 +108,7 @@ const PublicNotice = () => {
</Grid> </Grid>
</Grid> </Grid>
: :
<Grid container>
<Grid container sx={{ minHeight: '95vh', backgroundColor:'backgroundColor.default'}} direction="column">
<Grid item xs={12}> <Grid item xs={12}>
<div style={BackgroundHead}> <div style={BackgroundHead}>
<Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center">


+ 1
- 1
src/pages/PublicNotice/Search_GLD/index.js Näytä tiedosto

@@ -96,7 +96,7 @@ const UserSearchPage_Individual = () => {
</Grid> </Grid>
</Grid> </Grid>
: :
<Grid container sx={{ backgroundColor: 'backgroundColor.default' }}>
<Grid container sx={{ minHeight: '95vh',backgroundColor: 'backgroundColor.default' }} direction="column">
<Grid item xs={12}> <Grid item xs={12}>
<div style={BackgroundHead}> <div style={BackgroundHead}>
<Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center">


+ 1
- 1
src/pages/User/DetailsPage_Organization/index.js Näytä tiedosto

@@ -185,7 +185,7 @@ const UserMaintainPage_Organization = () => {
</Grid> </Grid>
</Grid> </Grid>
: :
<Grid container sx={{ backgroundColor: isGLDLoggedIn()?'backgroundColor.default':'#ffffff' }}>
<Grid container sx={{ minHeight: '95vh', backgroundColor: isGLDLoggedIn()?'backgroundColor.default':'#ffffff' }} direction="column">
<Grid item xs={12}> <Grid item xs={12}>
<div style={BackgroundHead}> <div style={BackgroundHead}>
<Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center">


+ 1
- 1
src/pages/User/SearchPage_Organization/index.js Näytä tiedosto

@@ -72,7 +72,7 @@ const UserSearchPage_Organization = () => {
</Grid> </Grid>
</Grid> </Grid>
: :
<Grid container sx={{backgroundColor:"backgroundColor.default"}}>
<Grid container sx={{minHeight: '95vh',backgroundColor:"backgroundColor.default"}} direction="column">
<Grid item xs={12}> <Grid item xs={12}>
<div style={BackgroundHead}> <div style={BackgroundHead}>
<Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center"> <Stack direction="row" height='70px' justifyContent="flex-start" alignItems="center">


+ 19
- 28
src/pages/authentication/ForgotPassword/ForgotPasswordApplyForm.js Näytä tiedosto

@@ -15,8 +15,8 @@ import {
import { useFormik } from 'formik'; import { useFormik } from 'formik';
import * as yup from 'yup'; import * as yup from 'yup';
import * as React from "react"; import * as React from "react";
// import * as HttpUtils from "utils/HttpUtils";
// import * as UrlUtils from "utils/ApiPathConst";
import * as HttpUtils from "utils/HttpUtils";
import * as UrlUtils from "utils/ApiPathConst";
// import * as FieldUtils from "utils/FieldUtils"; // import * as FieldUtils from "utils/FieldUtils";
import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png' import titleBackgroundImg from 'assets/images/dashboard/gazette-bar.png'
import ForwardIcon from '@mui/icons-material/Forward'; import ForwardIcon from '@mui/icons-material/Forward';
@@ -60,32 +60,23 @@ const ForgotPasswordApplyForm = () => {
}), }),
onSubmit: values => { onSubmit: values => {
console.log(values) console.log(values)
navigate('/forgot/password/sent');
// HttpUtils.postWithFiles({
// url: UrlUtils.POST_PUBLIC_NOTICE_APPLY,
// params: {
// id: 0,
// contactPerson: values.contactPerson,
// contactTelNo: {
// countryCode: values.tel_countryCode,
// phoneNumber: values.phoneNumber
// },
// contactFaxNo: {
// countryCode: values.fax_countryCode,
// faxNumber: values.faxNumber
// },
// issueId: issueId,
// careOf: values.careOf ? values.careOf: "",
// remarks: values.remarks ? values.remarks : "",
// },
// // files: [attachment],
// onSuccess: function () {
// notifyActionSuccess(intl.formatMessage({id: 'submissionSuccess'}) + '!')
// navigate("/publicNotice");
// // location.reload();
// }
// });
HttpUtils.post({
url: UrlUtils.POST_FORGOT_PASSWORD_EMAIL,
params: {
username: values.username,
},
// files: [attachment],
onSuccess: function () {
// notifyActionSuccess(intl.formatMessage({id: 'submissionSuccess'}) + '!')
navigate('/forgot/password/sent');
console.log("jjj")
// location.reload();
},
onError:function () {
navigate('/forgot/password/sent');
console.log("hihihi")
}
});
} }
}); });




+ 8
- 7
src/pages/authentication/auth-forms/AuthLoginCustom.js Näytä tiedosto

@@ -1,7 +1,8 @@
import React, { import React, {
useEffect, useEffect,
useState, useState,
lazy, useContext
lazy,
// useContext
} from 'react'; } from 'react';
import { Link as RouterLink } from 'react-router-dom'; import { Link as RouterLink } from 'react-router-dom';
import { useNavigate } from 'react-router-dom'; import { useNavigate } from 'react-router-dom';
@@ -42,17 +43,17 @@ import { EyeOutlined, EyeInvisibleOutlined } from '@ant-design/icons';
import iAmSmartICon from 'assets/images/icons/icon_iAmSmart.png'; import iAmSmartICon from 'assets/images/icons/icon_iAmSmart.png';
import { useDispatch } from "react-redux"; import { useDispatch } from "react-redux";
import { handleLogin } from "auth/index"; import { handleLogin } from "auth/index";
import useJwt from "../../../auth/jwt/useJwt";
import useJwt from "auth/jwt/useJwt";
import { handleLogoutFunction } from 'auth/index'; import { handleLogoutFunction } from 'auth/index';
import {FormattedMessage, useIntl} from "react-intl"; import {FormattedMessage, useIntl} from "react-intl";
import LocaleContext from "../../../components/I18nProvider";
// import LocaleContext from "components/I18nProvider";
// ============================|| FIREBASE - LOGIN ||============================ // // ============================|| FIREBASE - LOGIN ||============================ //


const AuthLoginCustom = () => { const AuthLoginCustom = () => {
const dispatch = useDispatch() const dispatch = useDispatch()
const navigate = useNavigate() const navigate = useNavigate()
const intl = useIntl(); const intl = useIntl();
const { setLocale } = useContext(LocaleContext);
// const { setLocaleFromLogin } = useContext(LocaleContext);


const [showPassword, setShowPassword] = useState(false); const [showPassword, setShowPassword] = useState(false);
const handleClickShowPassword = () => { const handleClickShowPassword = () => {
@@ -93,15 +94,15 @@ const AuthLoginCustom = () => {
// setSuccess(true) // setSuccess(true)
// console.log(response.data); // console.log(response.data);
if(response.data.type === "GLD"){ if(response.data.type === "GLD"){
setLocale("en");
// setLocale("en");
localStorage.setItem('locale','en'); localStorage.setItem('locale','en');
}else{ }else{
if (response.data.preferLocale ==="zh_HK"){ if (response.data.preferLocale ==="zh_HK"){
setLocale("zh-HK");
// setLocale("zh-HK");
localStorage.setItem('locale','zh-HK'); localStorage.setItem('locale','zh-HK');
} }
if (response.data.preferLocale ==="zh-CN"){ if (response.data.preferLocale ==="zh-CN"){
setLocale("zh-CN");
// setLocale("zh-CN");
localStorage.setItem('locale','zh-CN'); localStorage.setItem('locale','zh-CN');
} }
} }


+ 3
- 3
src/pages/iAmSmart/AuthCallback/index.js Näytä tiedosto

@@ -50,15 +50,15 @@ const Index = () => {
} }
const data = { ...userData, accessToken: responseData.accessToken, refreshToken: responseData.refreshToken } const data = { ...userData, accessToken: responseData.accessToken, refreshToken: responseData.refreshToken }
if(responseData.type === "GLD"){ if(responseData.type === "GLD"){
setLocale("en");
// setLocale("en");
localStorage.setItem('locale','en'); localStorage.setItem('locale','en');
}else{ }else{
if (responseData.preferLocale ==="zh_HK"){ if (responseData.preferLocale ==="zh_HK"){
setLocale("zh-HK");
// setLocale("zh-HK");
localStorage.setItem('locale','zh-HK'); localStorage.setItem('locale','zh-HK');
} }
if (responseData.preferLocale ==="zh-CN"){ if (responseData.preferLocale ==="zh-CN"){
setLocale("zh-CN");
// setLocale("zh-CN");
localStorage.setItem('locale','zh-CN'); localStorage.setItem('locale','zh-CN');
} }
} }


+ 1
- 0
src/utils/ApiPathConst.js Näytä tiedosto

@@ -75,6 +75,7 @@ export const GET_ID = apiPath+'/user/verifyID';
export const GET_VERIFY_USER_ACCOUNT = apiPath+'/user/verifyEmail'; export const GET_VERIFY_USER_ACCOUNT = apiPath+'/user/verifyEmail';
export const GET_FORGOT_PASSWORD_VERIFY_USER_ACCOUNT = apiPath+'/user/verifyForgotPasswordEmail'; export const GET_FORGOT_PASSWORD_VERIFY_USER_ACCOUNT = apiPath+'/user/verifyForgotPasswordEmail';
export const POST_FORGOT_PASSWORD_NEW_PASSWORD = apiPath+'/user/forgotPasswordNewPassword'; export const POST_FORGOT_PASSWORD_NEW_PASSWORD = apiPath+'/user/forgotPasswordNewPassword';
export const POST_FORGOT_PASSWORD_EMAIL = apiPath+'/user/sendForgotPasswordEmail';




//Public //Public


Ladataan…
Peruuta
Tallenna