Kaynağa Gözat

jwt auth between BE and FE

feature/1371_homepage_and_navigation
Dzenis Hadzifejzovic 3 yıl önce
ebeveyn
işleme
a3655807da

+ 47
- 6
package-lock.json Dosyayı Görüntüle

@@ -4547,6 +4547,17 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/ansi-escapes/node_modules/type-fest": {
"version": "0.21.3",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz",
"integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==",
"engines": {
"node": ">=10"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/ansi-html": {
"version": "0.0.7",
"resolved": "https://registry.npmjs.org/ansi-html/-/ansi-html-0.0.7.tgz",
@@ -21496,9 +21507,11 @@
}
},
"node_modules/type-fest": {
"version": "0.21.3",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz",
"integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==",
"version": "0.13.1",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz",
"integrity": "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==",
"optional": true,
"peer": true,
"engines": {
"node": ">=10"
},
@@ -21531,6 +21544,19 @@
"is-typedarray": "^1.0.0"
}
},
"node_modules/typescript": {
"version": "4.8.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",
"integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==",
"peer": true,
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=4.2.0"
}
},
"node_modules/typescript-compare": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/typescript-compare/-/typescript-compare-0.0.2.tgz",
@@ -27415,6 +27441,13 @@
"integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==",
"requires": {
"type-fest": "^0.21.3"
},
"dependencies": {
"type-fest": {
"version": "0.21.3",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz",
"integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w=="
}
}
},
"ansi-html": {
@@ -40659,9 +40692,11 @@
"integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g=="
},
"type-fest": {
"version": "0.21.3",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz",
"integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w=="
"version": "0.13.1",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz",
"integrity": "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==",
"optional": true,
"peer": true
},
"type-is": {
"version": "1.6.18",
@@ -40685,6 +40720,12 @@
"is-typedarray": "^1.0.0"
}
},
"typescript": {
"version": "4.8.4",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz",
"integrity": "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==",
"peer": true
},
"typescript-compare": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/typescript-compare/-/typescript-compare-0.0.2.tgz",

+ 3
- 9
src/pages/LoginPage/LoginPageMUI.js Dosyayı Görüntüle

@@ -9,7 +9,6 @@ import { useTranslation } from "react-i18next";
import HrLogo from "../../assets/images/hrcenter.png";
import DiligLogo from "../../assets/images/logo_horizontal_black.png";
import googleLogo from "../../assets/images/google1.png";
import i18next from "i18next";
import {
clearLoginErrors,
fetchUser,
@@ -32,8 +31,6 @@ import Backdrop from "../../components/MUI/BackdropComponent";
import ErrorMessage from "../../components/MUI/ErrorMessageComponent";
import { selectIsLoadingByActionType } from "../../store/selectors/loadingSelectors";
import { LOGIN_USER_LOADING } from "../../store/actions/login/loginActionConstants";
import { fontSize } from "@mui/system";

const LoginPage = ({ history }) => {
const dispatch = useDispatch();
const { t } = useTranslation();
@@ -68,12 +65,12 @@ const LoginPage = ({ history }) => {
};

const handleSubmit = (values) => {
const { username: Username, password: Password } = values;
const { username,password } = values;
dispatch(clearLoginErrors());
dispatch(
fetchUser({
Username,
Password,
username,
password,
handleApiResponseSuccess,
})
);
@@ -123,9 +120,6 @@ const LoginPage = ({ history }) => {
sx={{ position: "relative" }}
>
<Backdrop position="absolute" isLoading={isLoading} />
{/* <label>Username:</label><br></br>
<input type='text' value={formik.values.username}
onChange={formik.handleChange}/> */}
<TextField
name="username"
label={t("common.labelUsername")}

+ 1
- 152
src/request/apiEndpoints.js Dosyayı Görüntüle

@@ -1,156 +1,5 @@
export default {
accounts: {
get: 'accounts/{accountUid}',
getCurrentUserPermissions:
'accounts/{currentAccountUid}/users/{currentUserUid}/permissions',
getAddresses: 'accounts/{accountUid}/addresses',
updateAddress: 'account/{accountUid}/addresses/{addressUid}',
deleteAddress: 'accounts/{accountUid}/addresses/{addressUid}',
getUsers: 'accounts/{accountUid}/users',
createUser: 'accounts/{accountUid}/users',
updateUser: 'account/{accountUid}/users/{userUid}?actionType={actionType}',
deleteUser: 'accounts/{accountUid}/users/{userUid}',
getSettings: 'accounts/{accountUid}/settings',
getIraSettings: 'accounts/{accountUid}/iraSettings',
getSettingsRegistration: 'application/settings',
agreement: 'accounts/agreement',
},
authentications: {
getUsernames: 'authenticate/usernames',
login: 'authenticate',
getUserSecurityQuestion: 'users/username/securityquestion',
confirmSecurityQuestion: 'authenticate/confirm',
confirmForgotPassword: 'users/passwords/reset_token',
resetPassword: 'users/passwords',
refreshToken: '/authenticate/refresh',
generateToken: '/authenticate/generate',
authenticate:
'/authenticate?fp={fp}&offer={offer}&landingPageUrl={landingPageUrl}&registrationFlowType={registrationFlowType}',
confirmAuthentication:
'/authenticate/confirm?fp={fp}&offer={offer}&landingPageUrl={landingPageUrl}&registrationFlowType={registrationFlowType}',
},
bankAccounts: {
get: 'accounts/{accountUid}/bankaccounts',
getBankAccount:
'accounts/{accountUid}/bankaccounts/{bankAccountUid}?type={type}',
getBankAccountsByType:
'accounts/{accountUid}/bankaccounts?type={type}&active=true',
getBankDetailsByRoutingNumber: 'banks/{routingNumber}',
newAccount: 'accounts/{accountUid}/bankaccounts',
deleteAccount:
'accounts/{accountUid}/bankaccounts/{bankAccountUid}?type={type}',
verify: '/accounts/{accountUid}/bankaccountverification/{bankAccountUid}',
postBankAccountRegistration: '/accounts/{applicationUid}/bankaccounts',
getRegistration: 'banks/{applicationUid}/bankaccounts',
},
documents: {
getDocuments: 'accounts/{accountUid}/documents?year={year}',
getDocument: 'accounts/{accountUid}/documents/{documentType}',
},
countries: '/countries',
metalStream: {
getMetalStreamSettings: 'accounts/{accountUid}/metalstream',
getMetalStreamFundings: 'applications/{applicationUid}/metalStreamFunding',
},
orders: {
buyForStorage: '/accounts/{accountUid}/orders/buyForStorage',
buyForDelivery: '/accounts/{accountUid}/orders/buyForDelivery',
verifyBuyForDelivery: '/accounts/{accountUid}/orders/buyForDelivery/verify',
sellFromStorage: '/accounts/{accountUid}/orders/sellFromStorage',
fractionalConversion: '/accounts/{accountUid}/orders/fractionalConversion',
deliverFromStorageVerify:
'/accounts/{accountUid}/orders/deliverFromStorage/verify',
deliverFromStorage: '/accounts/{accountUid}/orders/deliverFromStorage',
iraCashDistribution: '/accounts/{accountUid}/orders/iraCashDistribution',
iraCashTransfer: '/accounts/{accountUid}/orders/iraCashTransfer',
iraFeeWithdrawal: 'accounts/{accountUid}/orders/iraFeeWithdrawal',
achDeposit: 'accounts/{accountUid}/orders/achDeposit',
wireWithdrawal: '/accounts/{accountUid}/orders/wireWithdrawal',
checkWithdrawal: '/accounts/{accountUid}/orders/checkWithdrawal',
},
portfolio: {
getPortfolioValuations: 'accounts/{accountUid}/portfolio/valuations',
getPortfolioMetalPrices: 'marketprices',
getPortfolioHoldings:
'accounts/{accountUid}/portfolio/products?valuation=true',
getPortfolioProductCodes: '/accounts/{accountUid}/portfolio/productcodes',
getPortfolioBalances: '/accounts/{accountUid}/portfolio/balances',
getPortfolioProductBySymbol:
'/accounts/{accountUid}/portfolio/products/{symbol}',
getPortfolioTransactions: '/accounts/{accountUid}/transactions',
getPortfolioSingleTransaction:
'/accounts/{accountUid}/transactions/{transactionUid}',
getProductPortoflioTransactions: 'accounts/{accountUid}/transactions',
getRecentPortfolioTransactions:
'accounts/{accountUid}/transactions?content=Recent',
getFinancialPortfolioTransactions: 'accounts/{accountUid}/transactions',
getFinancialPortfolioPendingTransactions:
'accounts/{accountUid}/transactions/fundinghistory',
patchFinancialPortfolioPendingTransactions:
'/accounts/{accountUid}/transactions/fundinghistory/{depositKey}',
},
products: {
getPrices: '/accounts/{accountUid}/products/prices',
prices: 'accounts/{accountUid}/products/prices?side={side}',
tiers:
'/accounts/{accountUid}/products/prices/{symbol}/tiers?side={side}&location={location}',
symbolPrices: '/accounts/{accountUid}/products/{symbol}/prices?side={side}',
getPricesRegistration: 'applications/{applicationUid}/products/prices',
},
settings: {
get: 'settings',
},
taxForms: {
getTaxForms: 'settings/taxForms/{applicationType}',
},
users: {
getAccounts: '/users/{userUid}/accounts',
getRegistrationAccounts: '/users/{userUid}/accounts',
updateUser: '/users/{userUid}?updateUserActionType={actionType}',
updateUserPassword: '/users/{userUid}/passwords',
logout: '/users/{userUid}/logout',
getUsernames: '/users/email',
createUser:
'/users?fp={fp}&offer={offer}&landingPageUrl={landingPageUrl}&registrationFlowType={registrationFlowType}',
updateUserRegistration: '/users/{userUid}',
invite: '/users/invite',
},
applications: {
application: '/applications/{applicationUid}',
addPerson: '/applications/{applicationUid}/persons',
updatePerson: '/applications/{applicationUid}/persons/{personUid}',
addPersonWithGiftState:
'/applications/{applicationUid}/UTMA/persons?giftState={giftState}',
updatePersonWithGiftState:
'/applications/{applicationUid}/UTMA/persons/{personUid}?giftState={giftState}',
addPersonWithCompanyName:
'/applications/{applicationUid}/IRA/persons?companyName={companyName}',
updatePersonWithCompanyName:
'/applications/{applicationUid}/IRA/persons/{personUid}?companyName={companyName}',
submitLegalEntity: '/applications/{applicationUid}/legalEntities',
updateLegalEntity:
'/applications/{applicationUid}/legalEntities/{personUid}',
postNonIraFunding: '/applications/{applicationUid}/funding',
postIraFunding: '/applications/{applicationUid}/iraFunding',
postMSFunding: '/applications/{applicationUid}/metalStreamFunding',
consent: '/applications/{applicationUid}/consents',
updateConsent: `/applications/{applicationUid}/consents/{agreementConsentUid}`,
submitMetalStreamRegistration:
'/applications/{applicationUid}/metalStreamFunding',
},
common: {
getCountries: '/countries/',
getTaxForms: '/taxForms/',
getContributionYears: 'contributionYears',
getCountryStates: '/countries/{iso3CountryCode}/states/',
getSecurityQuestions: '/registration/securityQuestions/',
getPortalSecurityQuestions: '/securityQuestions',
},
plaid: {
getToken: '/bankaccounts/createplaidlinktoken',
},
affiliate: {
setCookie: '/affiliate/picture',
setFingerprint: '/affiliate/fingerprint',
login: 'http://localhost:26081/v1/users/authenticate',
},
};

+ 1
- 1
src/store/reducers/login/loginReducer.js Dosyayı Görüntüle

@@ -36,7 +36,7 @@ export default createReducer(
function setUser(state, action) {
return {
...state,
token: action.payload,
user: action.payload,
};
}


+ 2
- 2
src/store/saga/loginSaga.js Dosyayı Görüntüle

@@ -60,8 +60,8 @@ function* fetchUser({ payload }) {
}
} catch (e) {
if (e.response && e.response.data) {
if (payload.handleApiResponseSuccess) {
yield call(payload.handleApiResponseSuccess);
if (payload.handleApiResponseFailed) {
yield call(payload.handleApiResponseFailed);
}
const errorMessage = yield call(rejectErrorCodeHelper, e);
yield put(fetchUserError(errorMessage));

+ 2
- 2
src/util/helpers/rejectErrorCodeHelper.js Dosyayı Görüntüle

@@ -5,10 +5,10 @@ export const rejectErrorCodeHelper = (error) => {
const errorCode = error?.response?.data?.Errors[0]?.Code;
const errorMessage = errorCode
? i18next.t(`apiErrors.${errorCode}`)
: i18next.t('apiErrors.SomethingWentWrong');
: i18next.t(error.response.data.message);

return errorMessage;
}

return i18next.t('apiErrors.SomethingWentWrong');
return i18next.t(error.response.data.message);
};

+ 14
- 4
yarn.lock Dosyayı Görüntüle

@@ -12177,16 +12177,21 @@
"resolved" "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz"
"version" "4.0.8"

"type-fest@^0.13.1", "type-fest@^0.21.3":
"integrity" "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w=="
"resolved" "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz"
"version" "0.21.3"
"type-fest@^0.13.1":
"integrity" "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg=="
"resolved" "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz"
"version" "0.13.1"

"type-fest@^0.20.2":
"integrity" "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ=="
"resolved" "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz"
"version" "0.20.2"

"type-fest@^0.21.3":
"integrity" "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w=="
"resolved" "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz"
"version" "0.21.3"

"type-fest@^0.3.1":
"integrity" "sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ=="
"resolved" "https://registry.npmjs.org/type-fest/-/type-fest-0.3.1.tgz"
@@ -12251,6 +12256,11 @@
dependencies:
"typescript-compare" "^0.0.2"

"typescript@^3.2.1 || ^4", "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta":
"integrity" "sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ=="
"resolved" "https://registry.npmjs.org/typescript/-/typescript-4.8.4.tgz"
"version" "4.8.4"

"unbox-primitive@^1.0.1":
"integrity" "sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw=="
"resolved" "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz"

Loading…
İptal
Kaydet