-
-
Notifications
You must be signed in to change notification settings - Fork 177
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
added security step before account deletion #1705
added security step before account deletion #1705
Conversation
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.
@nmro184 good work! I will leave some comments:
This needs to be our dialog when it opens. The <TextField>
should be displayed directly, eliminating the intermediate step of clicking the "Delete Account" button to reveal the text field.
Additionally, create a constant const DELETE_ACCOUNT='delete-account'
and use it to compare the entered text and also to display it as a part of the label message. This approach allows you to remove both useEffect hooks.
To use a constant in the Formated Message:
DeleteConfirmationDialog.js
<TextField
autoFocus={true}
label={
<FormattedMessage
{...messages.deleteAccountFinal}
values={{ deleteAccount: 'delete-account' }}
/>
}
......../>
People.messages.js
deleteAccountFinal: {
id: 'cboard.components.Settings.People.deleteAccountFinal',
defaultMessage: 'To confirm, type "{deleteAccount}".',
},
One more thing, ensure the confirmationText
value is cleared when the dialog is closed.
@@ -67,6 +95,34 @@ const DeleteConfirmationDialog = ({ | |||
</Button> | |||
</DialogActions> | |||
)} | |||
{!isDeletingAccount && showConfirmationInput && ( | |||
<> | |||
<TextField |
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.
This component needs to be inside the <DialogContent>
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.
here I had a problem when I put the text field element inside DialogContent it shrinks and sticks to the left , also if its inside DialogActions , or outside of DialogContent in general it sticks to both sides of the dialog which doesn't look good , I know using inline css is not a best practice but I didn't know whether to create a new css file and if so where should I put it .
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.
also made sense to me to put it inside DialogActions because its kinda serves a role of a button , you know what I mean ? anyway its ok Im here to learn :)
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.
I see!! Take a look on material ui documentation under form dialog here. The text field it's inside the dialog content. Use that as a reference. Also you can take a look on the text field props.
You can add the fullWidth prop to deal with your problem!
The css file is not needed
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.
oh got it , I have committed the changes @RodriSanchez1
resolving #1699