-
Notifications
You must be signed in to change notification settings - Fork 0
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? Sign in to your account
Feat/frontend/disable 2fa #273
Conversation
WalkthroughThe recent update enhances the two-factor authentication (2FA) feature by allowing users to disable it. Specifically, the backend has been updated to return access token details upon disabling 2FA, and a corresponding frontend functionality has been added. This includes a new action to send a request for disabling 2FA and UI changes in the settings page, enabling users to easily disable 2FA through a dedicated button. Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
<form action={disableTwoFactorAuthentication}> | ||
<Button type="submit">Disable 2FA</Button> | ||
</form> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The form submission for disabling 2FA is incorrectly using the action
attribute with a function reference. In React, form submissions should be handled through an onSubmit
event handler. Additionally, there's no handling of the asynchronous operation or user feedback on success or failure.
- <form action={disableTwoFactorAuthentication}>
+ <form onSubmit={async (e) => {
+ e.preventDefault();
+ try {
+ const result = await disableTwoFactorAuthentication();
+ // Handle success, e.g., show a success message or redirect
+ } catch (error) {
+ // Handle error, e.g., show an error message
+ }
+ }}>
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
<form action={disableTwoFactorAuthentication}> | |
<Button type="submit">Disable 2FA</Button> | |
</form> | |
<form onSubmit={async (e) => { | |
e.preventDefault(); | |
try { | |
const result = await disableTwoFactorAuthentication(); | |
// Handle success, e.g., show a success message or redirect | |
} catch (error) { | |
// Handle error, e.g., show an error message | |
} | |
}}> | |
<Button type="submit">Disable 2FA</Button> | |
</form> |
設定済みの場合は、こんな感じで非有効化ボタンを配置しました。