You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 5, 2024. It is now read-only.
* fixed tests, added shallow logic.
* updated feature files, and step def.
* FF-106 Write Logic for User Edit
* Tweaked Cucumber Steps. Fixed Serialization.
* Added additional check, fixed some bugs.
* FF-106 Wrote UnitTests for User Edit
* Damn you password check.
* Bumped Version to v0.0.5
@@ -97,14 +107,15 @@ public void registerNewUser(UserRegisterForm newUser) {
97
107
98
108
// check pws.
99
109
Stringpassword = newUser.getPassword();
100
-
passwordIsValid(password);
110
+
if (!passwordIsValid(password))
111
+
thrownewUserNotRegisteredException("Password needs to be at least 8 characters long and, contains at least one uppercase and lowercase letter and a number.");
thrownewUserNotRegisteredException("Password needs to be at least 8 characters long and, contains at least one uppercase and lowercase letter and a number.");
if (!stringIsValid(password) || !stringIsValid(confirmation))
195
+
thrownewUserNotUpdatedException("Wanted to change password, but password was not valid.");
196
+
197
+
if (!passwordIsValid(password))
198
+
thrownewUserNotUpdatedException("Password needs to be at least 8 characters long and, contains at least one uppercase and lowercase letter and a number.");
199
+
200
+
if (!password.contentEquals(confirmation))
201
+
thrownewUserNotUpdatedException("Passwords do not match.");
202
+
203
+
if (password.toLowerCase().contains(userEntityToUpdate.getLowercaseUsername()))
204
+
thrownewUserNotUpdatedException("Username must not appear in password.");
205
+
206
+
changesWereMade = true;
207
+
newUpdate.set("password", password);
208
+
}
209
+
210
+
// groups
211
+
if (null != userToUpdate.getGroupIds()) {
212
+
try {
213
+
for (Groupsgroup : groupRepository.getGroupsByIds(userToUpdate.getGroupIds())) {
214
+
if (group == Groups.ADMIN && !authenticatedUserIsAdmin)
215
+
thrownewUserNotUpdatedException("Only admins can add users to group " + Groups.ADMIN.getDisplayName());
216
+
}
217
+
} catch (IllegalArgumentExceptionexception) {
218
+
thrownewUserNotUpdatedException("One or more groups do not exist.");
0 commit comments