forgot password in login page and account info implemented, sms.ir service works fine with sandbox key.
This commit is contained in:
@@ -23,6 +23,7 @@ interface AuthContextType {
|
||||
email: string,
|
||||
password: string,
|
||||
name: string,
|
||||
mobile: string,
|
||||
organizationName: string,
|
||||
organizationEmail: string,
|
||||
organizationType: 'CLINIC' | 'LAB'
|
||||
@@ -37,6 +38,7 @@ interface AuthContextType {
|
||||
planName?: string,
|
||||
) => Promise<string>;
|
||||
setUserLanguage: (language: string) => void;
|
||||
refreshSession: () => Promise<void>;
|
||||
clearError: () => void;
|
||||
}
|
||||
|
||||
@@ -158,6 +160,7 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
|
||||
email: string,
|
||||
password: string,
|
||||
name: string,
|
||||
mobile: string,
|
||||
organizationName: string,
|
||||
organizationEmail: string,
|
||||
organizationType: 'CLINIC' | 'LAB'
|
||||
@@ -168,6 +171,7 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
|
||||
|
||||
const response = await authApi.registerTrial({
|
||||
email,
|
||||
mobile,
|
||||
password,
|
||||
name,
|
||||
organizationName,
|
||||
@@ -284,7 +288,16 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
|
||||
plan: (organization as { plan?: Organization['plan'] }).plan,
|
||||
});
|
||||
|
||||
router.push('/today');
|
||||
const redirectPath =
|
||||
typeof window !== 'undefined'
|
||||
? sessionStorage.getItem('authRedirect')
|
||||
: null;
|
||||
if (redirectPath) {
|
||||
sessionStorage.removeItem('authRedirect');
|
||||
router.push(redirectPath);
|
||||
} else {
|
||||
router.push('/today');
|
||||
}
|
||||
|
||||
} catch (err: any) {
|
||||
setError(err.message);
|
||||
@@ -327,6 +340,10 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
|
||||
}
|
||||
}, [normalizeProfilePayload, t]);
|
||||
|
||||
const refreshSession = useCallback(async () => {
|
||||
await checkAuth();
|
||||
}, [checkAuth]);
|
||||
|
||||
const clearError = useCallback(() => setError(null), []);
|
||||
|
||||
const setUserLanguage = useCallback((language: string) => {
|
||||
@@ -348,6 +365,7 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
|
||||
selectOrganization,
|
||||
createOrganization,
|
||||
setUserLanguage,
|
||||
refreshSession,
|
||||
clearError,
|
||||
}),
|
||||
[
|
||||
@@ -363,6 +381,7 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
|
||||
selectOrganization,
|
||||
createOrganization,
|
||||
setUserLanguage,
|
||||
refreshSession,
|
||||
clearError,
|
||||
],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user