File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
src/main/java/org/b3log/solo/service Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -274,6 +274,9 @@ public String addUser(final JSONObject requestJSONObject) throws ServiceExceptio
274
274
try {
275
275
final JSONObject user = new JSONObject ();
276
276
final String userEmail = requestJSONObject .optString (User .USER_EMAIL ).trim ().toLowerCase ();
277
+ if (!Strings .isEmail (userEmail )) {
278
+ throw new ServiceException (langPropsService .get ("mailInvalidLabel" ));
279
+ }
277
280
final JSONObject duplicatedUser = userRepository .getByEmail (userEmail );
278
281
279
282
if (null != duplicatedUser ) {
@@ -287,6 +290,9 @@ public String addUser(final JSONObject requestJSONObject) throws ServiceExceptio
287
290
user .put (User .USER_EMAIL , userEmail );
288
291
289
292
final String userName = requestJSONObject .optString (User .USER_NAME );
293
+ if (UserExt .invalidUserName (userName )) {
294
+ throw new ServiceException (langPropsService .get ("userNameInvalidLabel" ));
295
+ }
290
296
user .put (User .USER_NAME , userName );
291
297
292
298
final String userPassword = requestJSONObject .optString (User .USER_PASSWORD );
You can’t perform that action at this time.
0 commit comments