Revision 1e1441bf src/gr/grnet/pithos/web/client/PermissionsAddDialog.java
b/src/gr/grnet/pithos/web/client/PermissionsAddDialog.java | ||
---|---|---|
42 | 42 |
import com.google.gwt.event.dom.client.ClickEvent; |
43 | 43 |
import com.google.gwt.event.dom.client.ClickHandler; |
44 | 44 |
import com.google.gwt.event.dom.client.KeyCodes; |
45 |
import com.google.gwt.regexp.shared.RegExp; |
|
45 | 46 |
import com.google.gwt.user.client.Event.NativePreviewEvent; |
46 | 47 |
import com.google.gwt.user.client.ui.Anchor; |
47 | 48 |
import com.google.gwt.user.client.ui.Button; |
... | ... | |
139 | 140 |
protected void addPermission() { |
140 | 141 |
String selected = null; |
141 | 142 |
if (userAdd) { |
142 |
selected = userBox.getText(); |
|
143 |
selected = userBox.getText().trim(); |
|
144 |
RegExp emailValidator = RegExp.compile("^[A-Z0-9._%+-]+@[A-Z0-9.-]+.[A-Z]{2,4}$", "i"); |
|
145 |
if (!emailValidator.test(selected)) { |
|
146 |
app.displayWarning("Username must be a valid email address"); |
|
147 |
return; |
|
148 |
} |
|
143 | 149 |
} else if (groupBox.getSelectedIndex() > -1) { |
144 | 150 |
String groupName = groupBox.getValue(groupBox.getSelectedIndex()); |
145 | 151 |
selected = app.getUsername() + ":" + groupName; |
... | ... | |
148 | 154 |
return; |
149 | 155 |
} |
150 | 156 |
if (selected == null || selected.length() == 0 || selected.equals(app.getUsername() + ":")) { |
151 |
app.displayError("You have to select o username or group");
|
|
157 |
app.displayWarning("You have to select a username or group");
|
|
152 | 158 |
return; |
153 | 159 |
} |
160 |
|
|
154 | 161 |
boolean readValue = read.getValue(); |
155 | 162 |
boolean writeValue = write.getValue(); |
156 | 163 |
|
Also available in: Unified diff