Skip to content

Commit

Permalink
Merge branch 'feature/shibui-2269' of bitbucket.org:unicon/shib-idp-u…
Browse files Browse the repository at this point in the history
…i into feature/shibui-2269
  • Loading branch information
Bill Smith committed Jul 12, 2022
2 parents 717e053 + 2f33071 commit f896777
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions backend/src/main/resources/i18n/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,7 @@ message.must-be-number=Must be a number.
message.name-must-be-unique=Name must be unique.
message.uri-valid-format=URI must be valid format.
message.id-unique=ID must be unique.
message.name-unique=Service provider name must be unique.
message.array-items-must-be-unique=Items in list must be unique.
message.valid-duration=Must be a valid duration.
message.valid-name=No special characters or whitespace allowed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const SourceBase = {

const sources = current ? data.filter(s => s.id !== current.id) : data;
const entityIds = sources.map(s => s.entityId);
const names = sources.map(s => s.serviceProviderName);
const pattern = group?.validationRegex ? new RegExp(group?.validationRegex) : null;

return (formData, errors) => {
Expand All @@ -32,6 +33,10 @@ export const SourceBase = {
errors.entityId.addError('message.id-unique');
}

if (names.indexOf(formData.serviceProviderName) > -1) {
errors.serviceProviderName.addError('message.name-unique');
}

if (pattern && !pattern?.test(formData.entityId)) {
errors.entityId.addError(translator('message.group-pattern-fail', {regex: group?.validationRegex}));
}
Expand Down

0 comments on commit f896777

Please sign in to comment.