-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Add workspace name validation in App #13978
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
Changes from all commits
571ee74
9a4c1ed
6ae1577
617369d
838a9fb
eacc914
1c91cfc
5b8b9ac
5cf6e5e
0ffd526
51c619f
8c6cef4
4d46195
3a3ab8d
e7da93b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,8 +35,8 @@ class WorkspaceSettingsPage extends React.Component { | |
| constructor(props) { | ||
| super(props); | ||
|
|
||
| this.submit = this.submit.bind(this); | ||
| this.getCurrencyItems = this.getCurrencyItems.bind(this); | ||
| this.submit = this.submit.bind(this); | ||
| this.validate = this.validate.bind(this); | ||
| } | ||
|
|
||
|
|
@@ -55,17 +55,24 @@ class WorkspaceSettingsPage extends React.Component { | |
| if (this.props.policy.isPolicyUpdating) { | ||
| return; | ||
| } | ||
| const name = values.name.trim(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👋 Leaving a note that this has caused a regression in #18006.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Damn! 😕 thanks |
||
| const outputCurrency = values.currency; | ||
| Policy.updateGeneralSettings(this.props.policy.id, name, outputCurrency); | ||
| Policy.updateGeneralSettings(this.props.policy.id, values.name, outputCurrency); | ||
| Keyboard.dismiss(); | ||
| } | ||
|
|
||
| validate(values) { | ||
| const errors = {}; | ||
| if (!values.name || !values.name.trim().length) { | ||
|
ctkochan22 marked this conversation as resolved.
|
||
| const name = values.name.trim(); | ||
|
|
||
| // Searches for anything that looks like an html tag "< >"" | ||
| if (name.search(/<(.|\n)*?>/g) !== -1) { | ||
| errors.name = this.props.translate('workspace.editor.nameHasHtml'); | ||
| } | ||
|
|
||
| if (!name || !name.length) { | ||
| errors.name = this.props.translate('workspace.editor.nameIsRequiredError'); | ||
| } | ||
|
|
||
| return errors; | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.