8000 fix: reset password by 16-karan · Pull Request #560 · credebl/studio · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: reset password #560

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Si 8000 gn in to your account

Merged
merged 5 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/commonComponents/EcosystemProfileCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ const EcosystemProfileCard = ({getEndorsementListData}:IEndorsement) => {
await getEndorsementListData()
}


useEffect(() => {
fetchEcosystemDetails();
}, []);
Expand Down
10 changes: 0 additions & 10 deletions src/commonComponents/PasseyAddDevicePopup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,6 @@ const PasskeyAddDevice = (props: {
const savePassword = async (values: PasswordValue) => {
try {
const storedEmail = await getFromLocalStorage(storageKeys.LOGIN_USER_EMAIL);
const { error } = await getSupabaseClient().auth.signInWithPassword({
email: storedEmail,
password: values.Password,
});
if (error) {
setFidoUserError(error?.message)

} else {
const payload = {
password: passwordEncryption(values.Password)
}
Expand All @@ -48,8 +40,6 @@ const PasskeyAddDevice = (props: {
} else {
setFidoUserError(passkeyUserDetailsResp as string)
}

}
} catch (error) {
console.error('An unexpected error occurred:', error.message);
setFidoUserError('An unexpected error occurred')
Expand Down
6 changes: 3 additions & 3 deletions src/components/Authentication/KeyCloakResetPassword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { passwordEncryption, resetPasswordKeyCloak } from '../../api/Auth';
import { PassInvisible, PassVisible } from './Svg.js';
import { pathRoutes } from '../../config/pathRoutes';
import type { IPassword, IProps, IValues } from './interfaces';
import React from 'react';

const KeyClockResetPassword = (props: IProps) => {
const [loading, setLoading] = useState(false);
Expand All @@ -34,7 +35,7 @@ const KeyClockResetPassword = (props: IProps) => {
if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) {
setSuccess(data.message);
setLoading(false);
window.location.href = pathRoutes.landingPage.landingPage;
window.location.href= pathRoutes.auth.sinIn
} else {
setError(response as string);
setLoading(false);
Expand Down Expand Up @@ -179,9 +180,8 @@ const KeyClockResetPassword = (props: IProps) => {
</div>
{formikHandlers?.errors?.newPassword &&
typeof formikHandlers?.errors?.newPassword === 'string' &&
formikHandlers?.errors?.newPassword &&
formikHandlers?.touched?.newPassword && (
<span className="text-red-500 text-xs absolute mt-1">
<span className="text-red-500 text-xs mt-1">
{formikHandlers?.errors?.newPassword}
</span>
)}
Expand Down
9 changes: 7 additions & 2 deletions src/components/Authentication/SignInUserPassword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ const SignInUserPassword = (signInUserProps: SignInUser3Props) => {
setLoading(true);
const loginRsp = await loginUser(payload);
const { data } = loginRsp as AxiosResponse;

if (data?.statusCode === apiStatusCodes.API_STATUS_SUCCESS) {
if (data?.data?.isRegisteredToSupabase) {
setOpenModel(true);
Expand Down Expand Up @@ -112,8 +112,13 @@ const SignInUserPassword = (signInUserProps: SignInUser3Props) => {
}
} else {
8000 setLoading(false);
setFailure(loginRsp as string);
if (loginRsp.toString().includes('401')) {
setFailure('Invalid Credntials');
} else {
setFailure(loginRsp as string);
}
}
setLoading(false);
};

const handleBackButtonClick = () => {
Expand Down
19 changes: 9 additions & 10 deletions src/components/Resources/Schema/Create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,18 @@ const CreateSchema = () => {
},
],
};
const checkEcosystemData = async () => {
const data: ICheckEcosystem = await checkEcosystem();
setIsEcosystemData(data);
};

const [formData, setFormData] = useState(initFormData);

useEffect(() => {
const fetchData = async () => {
(async () => {
const orgId = await getFromLocalStorage(storageKeys.ORG_ID);
setOrgId(orgId);
};

fetchData();

const checkEcosystemData = async () => {
const data: ICheckEcosystem = await checkEcosystem();
setIsEcosystemData(data);
};
})();

checkEcosystemData();
}, []);
Expand Down Expand Up @@ -283,7 +282,7 @@ const CreateSchema = () => {
</div>
{isEcosystemData?.isEnabledEcosystem && (
<div className="mx-6 mb-4">
<EcosystemProfileCard />
<EcosystemProfileCard getEndorsementListData={checkEcosystemData} />
</div>
)}

Expand Down
8 changes: 5 additions & 3 deletions src/services/axiosIntercepter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import axios from 'axios'
import { envConfig } f 5D32 rom '../config/envConfig';
import { pathRoutes } from '../config/pathRoutes';
import { getFromLocalStorage } from '../api/Auth';
import { storageKeys } from '../config/CommonConstant';

const instance = axios.create({
baseURL: envConfig.PUBLIC_BASE_URL
Expand All @@ -21,13 +23,13 @@ instance.interceptors.response.use(function (response) {
// Any status codes that falls outside the range of 2xx cause this function to trigger
// Do something with response error
const errorRes = error?.response;

if(errorRes?.status === 401){
const token = await getFromLocalStorage(storageKeys.TOKEN)
if(errorRes?.status === 401 && token){
await localStorage.clear()
window.location.href = pathRoutes.auth.sinIn
}

return Promise.reject(error);
});

export default instance
export default instance
0