mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-04-19 20:56:52 +00:00
fix: update error messages and statuses in VerifyRegistrationOTP function for clarity
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 4m45s
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 4m45s
This commit is contained in:
parent
cd2cff7926
commit
e0e3de064a
@ -152,7 +152,7 @@ export async function signup(_actionState: ActionState, formData: FormData) {
|
||||
backendRegister({
|
||||
payload: {
|
||||
firstname: parsedData.data.name.split(" ")[0],
|
||||
lastname: parsedData.data.name.split(" ")[1],
|
||||
lastname: parsedData.data.name.split(" ").slice(1).join(" "),
|
||||
username: parsedData.data.phone_number,
|
||||
address: parsedData.data.address,
|
||||
id_card: parsedData.data.id_card,
|
||||
|
@ -43,7 +43,7 @@ export default function VerifyRegistrationOTPForm({
|
||||
hidden
|
||||
/>
|
||||
<Input
|
||||
disabled={isPending}
|
||||
disabled={isPending || state.status === "verify_error"}
|
||||
id="otp-number"
|
||||
name="otp"
|
||||
maxLength={6}
|
||||
@ -58,7 +58,11 @@ export default function VerifyRegistrationOTPForm({
|
||||
<p className="text-red-500 text-sm">{state.message}</p>
|
||||
)}
|
||||
</div>
|
||||
<Button className="w-full" disabled={isPending} type="submit">
|
||||
<Button
|
||||
className="w-full"
|
||||
disabled={isPending || state.status === "verify_error"}
|
||||
type="submit"
|
||||
>
|
||||
{isPending ? (
|
||||
<Loader2 className="animate-spin" />
|
||||
) : (
|
||||
|
@ -174,8 +174,9 @@ export async function VerifyRegistrationOTP(
|
||||
|
||||
if (error) {
|
||||
return {
|
||||
message: "Your account could not be verified. Please contact support.",
|
||||
status: "verify_error",
|
||||
message:
|
||||
"There was an error fetching your account information. Please contact support.",
|
||||
status: "user_check_error",
|
||||
};
|
||||
}
|
||||
if (userVerified.verified) {
|
||||
@ -184,13 +185,18 @@ export async function VerifyRegistrationOTP(
|
||||
);
|
||||
if (mobileLoginError) {
|
||||
return {
|
||||
message: "Your account could not be verified. Please contact support.",
|
||||
status: "verify_error",
|
||||
message: "Login Failed. Please contact support.",
|
||||
status: "login_error",
|
||||
};
|
||||
}
|
||||
if (mobileLoginResponse) {
|
||||
redirect(`/auth/verify-otp?phone_number=${mobile}`);
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
message: "Your account could not be verified. Please contact support.",
|
||||
status: "verify_error",
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
|
Loading…
x
Reference in New Issue
Block a user