Skip to content

Prevent saving of disallowed character strings for user's name and email - #3590

Merged
iAmWillShepherd merged 5 commits into
masterfrom
disallowed-characters-shall-not-pass
Dec 13, 2017
Merged

iAmWillShepherd merged 5 commits into
masterfrom
disallowed-characters-shall-not-pass

Conversation

@nerdneha

Copy link
Copy Markdown
Contributor

Fixes #3204

  • Checks against git's rules for name/email (replicated in our codebase as we don't expect them to change)
  • Surfaces dialog error message in preference window (includes disallowed character string)
  • Disabled save button when name or email has disallowed characters
  • Provides identifier rules function that checks if the string exclusively contains disallowed characters (test file explains many of the rules)

Valid name/email:
screen shot 2017-12-12 at 3 32 45 pm

Invalid name (with valid email):
screen shot 2017-12-12 at 3 31 25 pm

Invalid email (with valid name):
screen shot 2017-12-12 at 3 32 19 pm

Invalid name + email will show an error message for the name only; when the name is resolved, it will surface the dialog error message for an invalid email.

@nerdneha nerdneha added the ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Dec 12, 2017
@iAmWillShepherd iAmWillShepherd self-assigned this Dec 12, 2017
Comment thread app/src/ui/preferences/preferences.tsx Outdated
const disallowedNameCharacters = disallowedCharacters(name)
const disallowedEmailCharacters = disallowedCharacters(email)

if (disallowedNameCharacters) {

This comment was marked as spam.

Comment thread app/src/ui/preferences/preferences.tsx Outdated
return `Git name field cannot be a disallowed character "${
disallowedNameCharacters
}"`
} else if (disallowedEmailCharacters) {

This comment was marked as spam.

return `Git email field cannot be a disallowed character "${
disallowedEmailCharacters
}"`
} else {

This comment was marked as spam.

This comment was marked as spam.

Comment thread app/src/ui/preferences/preferences.tsx Outdated
}

private renderDisallowedCharactersError(message: string | null) {
if (message) {

This comment was marked as spam.

@iAmWillShepherd

Copy link
Copy Markdown
Contributor

Check #3538 for additional context on of my re-invigorated hatred of JS truthiness[es].

@nerdneha

Copy link
Copy Markdown
Contributor Author

@iAmWillShepherd
it's handled gif

@iAmWillShepherd

Copy link
Copy Markdown
Contributor

Works on my machine and yours, let's hope it works on everyone else's 😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review Pull Requests that are ready to be reviewed by the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants