hiteshchoudhary / ama-app

https://truefeedback.in
321 stars 63 forks source link

Multiple Sign-In Requests Allowed Without Entering Credentials #6

Open mohammad-1105 opened 7 months ago

mohammad-1105 commented 7 months ago

Description: Currently, users are able to click the sign-in button multiple times without entering any credentials. This results in multiple requests being sent to the backend, potentially causing unnecessary load and processing.

Steps to Reproduce:

Expected Behavior: Users should only be able to submit the sign-in form once, and subsequent clicks on the sign-in button without entering credentials should not trigger additional requests.

Proposed Solution: Implement client-side validation to disable the sign-in button until valid credentials are entered. This can help prevent multiple requests from being sent unintentionally. Additionally, consider adding visual feedback to indicate to the user that the sign-in process is underway.

My views: As observed, the sign-in button remains active even if no credentials are entered. To address this, we can utilize React's useState hook to disable the button upon submission. By setting a state variable to track the submission status, we can prevent multiple submissions. Additionally, considering the usage of react-hook-form, we can leverage its formState.isDirty property to conditionally disable the button until valid credentials are entered.