Skip to content

Commit

Permalink
Fix duplicate mail message #1028
Browse files Browse the repository at this point in the history
  • Loading branch information
syntrydy committed Sep 11, 2018
1 parent aa1074a commit 97e3aa3
Showing 1 changed file with 16 additions and 4 deletions.
Expand Up @@ -351,23 +351,23 @@ public String save() throws Exception {
if (!update) {
if (!userNameIsUniqAtCreationTime(this.person.getUid())) {
facesMessages.add(FacesMessage.SEVERITY_ERROR, "#{msg['UpdatePersonAction.faileAddUserUidExist']} %s",
person.getUid());
this.person.getUid());
return OxTrustConstants.RESULT_FAILURE;
}
if (!userEmailIsUniqAtCreationTime(this.person.getAttribute("mail"))) {
facesMessages.add(FacesMessage.SEVERITY_ERROR,
"#{msg['UpdatePersonAction.faileUpdateUserMailidExist']} %s", person.getMail());
"#{msg['UpdatePersonAction.faileUpdateUserMailidExist']} %s", this.person.getAttribute("mail"));
return OxTrustConstants.RESULT_FAILURE;
}
} else {
if (!userNameIsUniqAtEditionTime(this.person.getUid())) {
facesMessages.add(FacesMessage.SEVERITY_ERROR, "#{msg['UpdatePersonAction.faileAddUserUidExist']} %s",
person.getUid());
this.person.getUid());
return OxTrustConstants.RESULT_FAILURE;
}
if (!userEmailIsUniqAtEditionTime(this.person.getAttribute("mail"))) {
facesMessages.add(FacesMessage.SEVERITY_ERROR,
"#{msg['UpdatePersonAction.faileUpdateUserMailidExist']} %s", person.getMail());
"#{msg['UpdatePersonAction.faileUpdateUserMailidExist']} %s", this.person.getAttribute("mail"));
return OxTrustConstants.RESULT_FAILURE;
}
}
Expand Down Expand Up @@ -722,6 +722,9 @@ public void fetchFidoRecord(String id) {

public boolean userNameIsUniqAtCreationTime(String uid) {
boolean userNameIsUniq = true;
if(uid == null) {
return userNameIsUniq;
}
List<GluuCustomPerson> gluuCustomPersons = personService.getPersonsByUid(uid);
if (gluuCustomPersons != null && gluuCustomPersons.size() > 0) {
for (GluuCustomPerson gluuCustomPerson : gluuCustomPersons) {
Expand All @@ -735,6 +738,9 @@ public boolean userNameIsUniqAtCreationTime(String uid) {
}

public boolean userNameIsUniqAtEditionTime(String uid) {
if(uid == null) {
return true;
}
boolean userNameIsUniq = false;
List<GluuCustomPerson> gluuCustomPersons = personService.getPersonsByUid(uid);
if (gluuCustomPersons == null || gluuCustomPersons.isEmpty()) {
Expand All @@ -748,6 +754,9 @@ public boolean userNameIsUniqAtEditionTime(String uid) {
}

public boolean userEmailIsUniqAtCreationTime(String email) {
if(email == null) {
return true;
}
boolean emailIsUniq = true;
List<GluuCustomPerson> gluuCustomPersons = personService.getPersonsByEmail(email);
if (gluuCustomPersons != null && gluuCustomPersons.size() > 0) {
Expand All @@ -763,6 +772,9 @@ public boolean userEmailIsUniqAtCreationTime(String email) {

public boolean userEmailIsUniqAtEditionTime(String email) {
boolean emailIsUniq = false;
if(email == null) {
return true;
}
List<GluuCustomPerson> gluuCustomPersons = personService.getPersonsByEmail(email);
if (gluuCustomPersons == null || gluuCustomPersons.isEmpty()) {
emailIsUniq = true;
Expand Down

0 comments on commit 97e3aa3

Please sign in to comment.