forgot password in login page and account info implemented, sms.ir service works fine with sandbox key.

This commit is contained in:
2026-07-04 00:01:58 +03:30
parent 2f95559087
commit 3f7364dbf0
26 changed files with 1000 additions and 38 deletions

View File

@@ -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,
],
);