]> git.mxchange.org Git - jjobs-war.git/blob - src/java/org/mxchange/jjobs/beans/user/JobsAdminUserWebRequestBean.java
Please cherry-pick:
[jjobs-war.git] / src / java / org / mxchange / jjobs / beans / user / JobsAdminUserWebRequestBean.java
1 /*
2  * Copyright (C) 2016 Roland Häder
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Affero General Public License as
6  * published by the Free Software Foundation, either version 3 of the
7  * License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU Affero General Public License for more details.
13  *
14  * You should have received a copy of the GNU Affero General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 package org.mxchange.jjobs.beans.user;
18
19 import java.text.MessageFormat;
20 import java.util.Objects;
21 import javax.annotation.PostConstruct;
22 import javax.enterprise.context.RequestScoped;
23 import javax.enterprise.event.Event;
24 import javax.enterprise.event.Observes;
25 import javax.enterprise.inject.Any;
26 import javax.faces.FacesException;
27 import javax.faces.view.facelets.FaceletException;
28 import javax.inject.Inject;
29 import javax.inject.Named;
30 import javax.naming.Context;
31 import javax.naming.InitialContext;
32 import javax.naming.NamingException;
33 import org.mxchange.jcontacts.contact.Contact;
34 import org.mxchange.jcoreee.utils.FacesUtils;
35 import org.mxchange.jjobs.beans.BaseJobsController;
36 import org.mxchange.jjobs.beans.contact.JobsAdminContactWebRequestController;
37 import org.mxchange.jjobs.beans.contact.JobsContactWebSessionController;
38 import org.mxchange.jjobs.beans.helper.JobsWebRequestHelperController;
39 import org.mxchange.jjobs.beans.localization.JobsLocalizationSessionController;
40 import org.mxchange.jusercore.container.login.UserLoginContainer;
41 import org.mxchange.jusercore.events.registration.ObservableUserRegisteredEvent;
42 import org.mxchange.jusercore.events.user.add.AdminAddedUserEvent;
43 import org.mxchange.jusercore.events.user.add.ObservableAdminAddedUserEvent;
44 import org.mxchange.jusercore.events.user.delete.AdminDeletedUserEvent;
45 import org.mxchange.jusercore.events.user.delete.ObservableAdminDeletedUserEvent;
46 import org.mxchange.jusercore.events.user.linked.AdminLinkedUserEvent;
47 import org.mxchange.jusercore.events.user.linked.ObservableAdminLinkedUserEvent;
48 import org.mxchange.jusercore.events.user.locked.AdminLockedUserEvent;
49 import org.mxchange.jusercore.events.user.locked.ObservableAdminLockedUserEvent;
50 import org.mxchange.jusercore.events.user.unlocked.AdminUnlockedUserEvent;
51 import org.mxchange.jusercore.events.user.unlocked.ObservableAdminUnlockedUserEvent;
52 import org.mxchange.jusercore.events.user.update.AdminUpdatedUserDataEvent;
53 import org.mxchange.jusercore.events.user.update.ObservableAdminUpdatedUserDataEvent;
54 import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException;
55 import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException;
56 import org.mxchange.jusercore.exceptions.UserNotFoundException;
57 import org.mxchange.jusercore.exceptions.UserPasswordRepeatMismatchException;
58 import org.mxchange.jusercore.exceptions.UserStatusConfirmedException;
59 import org.mxchange.jusercore.exceptions.UserStatusLockedException;
60 import org.mxchange.jusercore.exceptions.UserStatusUnconfirmedException;
61 import org.mxchange.jusercore.model.user.AdminUserSessionBeanRemote;
62 import org.mxchange.jusercore.model.user.LoginUser;
63 import org.mxchange.jusercore.model.user.User;
64 import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
65 import org.mxchange.jusercore.model.user.UserUtils;
66 import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
67 import org.mxchange.jusercore.model.user.status.UserAccountStatus;
68
69 /**
70  * A user controller (bean)
71  * <p>
72  * @author Roland Häder<roland@mxchange.org>
73  */
74 @Named ("adminUserController")
75 @RequestScoped
76 public class JobsAdminUserWebRequestBean extends BaseJobsController implements JobsAdminUserWebRequestController {
77
78         /**
79          * Serial number
80          */
81         private static final long serialVersionUID = 542_145_347_916L;
82
83         /**
84          * An event fired when the administrator has added a new user
85          */
86         @Inject
87         @Any
88         private Event<ObservableAdminAddedUserEvent> addedUserEvent;
89
90         /**
91          * Regular contact controller
92          */
93         @Inject
94         private JobsAdminContactWebRequestController adminContactController;
95
96         /**
97          * Administrative user EJB
98          */
99         private AdminUserSessionBeanRemote adminUserBean;
100
101         /**
102          * Bean helper
103          */
104         @Inject
105         private JobsWebRequestHelperController beanHelper;
106
107         /**
108          * Regular contact controller
109          */
110         @Inject
111         private JobsContactWebSessionController contactController;
112
113         /**
114          * Event being fired when admin has deleted user
115          */
116         @Inject
117         @Any
118         private Event<ObservableAdminDeletedUserEvent> deleteUserEvent;
119
120         /**
121          * Localization controller
122          */
123         @Inject
124         private JobsLocalizationSessionController localizationController;
125
126         /**
127          * An event fired when the administrator has updated a new user
128          */
129         @Inject
130         @Any
131         private Event<ObservableAdminUpdatedUserDataEvent> updatedUserDataEvent;
132
133         /**
134          * General user EJB
135          */
136         private UserSessionBeanRemote userBean;
137
138         /**
139          * Regular user controller
140          */
141         @Inject
142         private JobsUserWebSessionController userController;
143
144         /**
145          * Delete reason
146          */
147         private String userDeleteReason;
148
149         /**
150          * An event fired when the administrator has linked a user with existing
151          * contact data.
152          */
153         @Inject
154         @Any
155         private Event<ObservableAdminLinkedUserEvent> userLinkedEvent;
156
157         /**
158          * User lock reason
159          */
160         private String userLockReason;
161
162         /**
163          * Event being fired when an administrator has locked a user
164          */
165         @Inject
166         @Any
167         private Event<ObservableAdminLockedUserEvent> userLockedEvent;
168
169         /**
170          * Flag whether user must change password after login
171          */
172         private Boolean userMustChangePassword;
173
174         /**
175          * User name
176          */
177         private String userName;
178
179         /**
180          * User password (clear-text from web form)
181          */
182         private String userPassword;
183
184         /**
185          * User password repeated (clear-text from web form)
186          */
187         private String userPasswordRepeat;
188
189         /**
190          * Event being fired when admin unlocks an account
191          */
192         @Inject
193         @Any
194         private Event<ObservableAdminUnlockedUserEvent> userUnlockedEvent;
195
196         /**
197          * Default constructor
198          */
199         public JobsAdminUserWebRequestBean () {
200         }
201
202         @Override
203         public String addUser () {
204                 // As the form cannot validate the data (required="true"), check it here
205                 if (this.getUserName() == null) {
206                         // Throw NPE
207                         throw new NullPointerException("userName is null"); //NOI18N
208                 } else if (this.getUserName().isEmpty()) {
209                         // Is empty
210                         throw new IllegalArgumentException("userName is null"); //NOI18N
211                 } else if (this.beanHelper.getContact() == null) {
212                         // No contact instance set, so test required fields: gender, first name and family name
213                         if (this.contactController.getGender() == null) {
214                                 // Throw NPE again
215                                 throw new NullPointerException("contactController.gender is null"); //NOI18N
216                         } else if (this.contactController.getFirstName() == null) {
217                                 // ... and again
218                                 throw new NullPointerException("contactController.firstName is null"); //NOI18N
219                         } else if (this.adminContactController.getFirstName().isEmpty()) {
220                                 // ... and again
221                                 throw new IllegalArgumentException("contactController.firstName is empty"); //NOI18N
222                         } else if (this.adminContactController.getFamilyName() == null) {
223                                 // ... and again
224                                 throw new NullPointerException("contactController.familyName is null"); //NOI18N
225                         } else if (this.contactController.getFamilyName().isEmpty()) {
226                                 // ... and again
227                                 throw new IllegalArgumentException("contactController.familyName is empty"); //NOI18N
228                         } else if (this.adminContactController.getEmailAddress() == null) {
229                                 // ... and again
230                                 throw new NullPointerException("contactController.emailAddress is null"); //NOI18N
231                         } else if (this.adminContactController.getEmailAddress().isEmpty()) {
232                                 // ... and again
233                                 throw new IllegalArgumentException("contactController.emailAddress is empty"); //NOI18N
234                         }
235                 }
236
237                 // Create new user instance
238                 User user = new LoginUser();
239
240                 // Set user name, CONFIRMED and INVISIBLE
241                 user.setUserName(this.getUserName());
242                 user.setUserMustChangePassword(this.getUserMustChangePassword());
243                 user.setUserAccountStatus(UserAccountStatus.CONFIRMED);
244                 user.setUserProfileMode(ProfileMode.INVISIBLE);
245
246                 // Init instance
247                 Contact contact;
248
249                 // Is a contact instance in helper set?
250                 if (this.beanHelper.getContact() instanceof Contact) {
251                         // Then use it for contact linking
252                         contact = this.beanHelper.getContact();
253                 } else {
254                         // Create contact instance
255                         contact = this.contactController.createContactInstance();
256                 }
257
258                 // Set contact in user
259                 user.setUserContact(contact);
260
261                 // Init variable for password
262                 String password = null;
263
264                 // Is the user name or email address used already?
265                 // @TODO Add password length check
266                 if (this.userController.isUserNameRegistered(user)) {
267                         // User name is already used
268                         throw new FaceletException(new UserNameAlreadyRegisteredException(user));
269                 } else if ((this.beanHelper.getContact() == null) && (this.contactController.isEmailAddressRegistered(user.getUserContact()))) {
270                         // Email address is already used
271                         this.showFacesMessage("admin_add_user:emailAddress", "ERROR_EMAIL_ADDRESS_ALREADY_USED"); //NOI18N
272
273                         // Always clear password
274                         this.setUserPassword(null);
275                         this.setUserPasswordRepeat(null);
276
277                         // Skip it
278                         return ""; //NOI18N
279                 } else if ((this.getUserPassword() == null && (this.getUserPasswordRepeat() == null)) || ((this.getUserPassword().isEmpty()) && (this.getUserPasswordRepeat().isEmpty()))) {
280                         // Empty password entered, then generate one
281                         password = UserUtils.createRandomPassword(JobsUserWebSessionController.MINIMUM_PASSWORD_LENGTH);
282                 } else if (!this.isSamePasswordEntered()) {
283                         // Both passwords don't match
284                         throw new FaceletException(new UserPasswordRepeatMismatchException(user));
285                 } else {
286                         // Both match, so get it from this bean
287                         password = this.getUserPassword();
288                 }
289
290                 // The password should not be null and at least 5 characters long
291                 assert (password != null) : "password is null"; //NOI18N
292                 assert (password.length() >= JobsUserWebSessionController.MINIMUM_PASSWORD_LENGTH) : "Password is not long enough."; //NOI18N
293
294                 // Encrypt password and set it
295                 user.setUserEncryptedPassword(UserUtils.encryptPassword(password));
296
297                 try {
298                         // Now, that all is set, call EJB
299                         if (this.beanHelper.getContact() instanceof Contact) {
300                                 // Link contact with this user
301                                 User updatedUser = this.adminUserBean.linkUser(user);
302
303                                 // Fire event
304                                 this.userLinkedEvent.fire(new AdminLinkedUserEvent(updatedUser));
305
306                                 // Remove contact instance
307                                 this.beanHelper.setContact(null);
308                         } else {
309                                 // Add new contact
310                                 User updatedUser = this.adminUserBean.addUser(user);
311
312                                 // Fire event
313                                 this.addedUserEvent.fire(new AdminAddedUserEvent(updatedUser));
314                         }
315                 } catch (final UserNameAlreadyRegisteredException | EmailAddressAlreadyRegisteredException ex) {
316                         // Throw again
317                         throw new FaceletException(ex);
318                 }
319
320                 // Clear helper
321                 this.beanHelper.setContact(null);
322
323                 // Clear this bean
324                 this.clear();
325
326                 // Return to user list (for now)
327                 return "admin_list_user"; //NOI18N
328         }
329
330         /**
331          * Event observer for new user registrations
332          * <p>
333          * @param event User registration event
334          */
335         public void afterUserRegistrationEvent (@Observes final ObservableUserRegisteredEvent event) {
336                 // event should not be null
337                 if (null == event) {
338                         // Throw NPE
339                         throw new NullPointerException("event is null"); //NOI18N
340                 } else if (event.getRegisteredUser() == null) {
341                         // Throw NPE again
342                         throw new NullPointerException("event.user is null"); //NOI18N
343                 } else if (event.getRegisteredUser().getUserId() == null) {
344                         // userId is null
345                         throw new NullPointerException("event.user.userId is null"); //NOI18N
346                 } else if (event.getRegisteredUser().getUserId() < 1) {
347                         // Not avalid id
348                         throw new IllegalArgumentException(MessageFormat.format("userId of user={0} is not valid: {1}", event.getRegisteredUser(), event.getRegisteredUser().getUserId())); //NOI18N
349                 }
350
351                 // Get user instance
352                 User registeredUser = event.getRegisteredUser();
353
354                 // @TODO Nothing to do with the user here?
355                 // Clear all data
356                 this.clear();
357         }
358
359         @Override
360         public String deleteUserData (final User user) {
361                 // Is the user instance valid and CONFIRMED?
362                 if (null == user) {
363                         // Throw NPE
364                         throw new NullPointerException("user is null"); //NOI18N
365                 } else if (user.getUserId() == null) {
366                         // Throw again
367                         throw new NullPointerException("user.userId is null"); //NOI18N
368                 } else if (user.getUserId() < 1) {
369                         // Invalid id number
370                         throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is not valid", user.getUserId())); //NOI18N
371                 }
372
373                 try {
374                         // All fine, delete it
375                         this.adminUserBean.deleteUser(user, this.getUserDeleteReason());
376                 } catch (final UserNotFoundException ex) {
377                         // Should not happen, so throw again
378                         throw new FaceletException(ex);
379                 }
380
381                 // Fire event
382                 this.deleteUserEvent.fire(new AdminDeletedUserEvent(user, this.getUserDeleteReason()));
383
384                 // Redirect
385                 return "admin_list_user"; //NOI18N
386         }
387
388         @Override
389         public String editUserData () {
390                 // Get user instance
391                 User user = this.beanHelper.getUser();
392
393                 // Null password means not setting it
394                 String encryptedPassword = null;
395
396                 // Check if user instance is in helper and valid
397                 if (null == user) {
398                         // Throw NPE
399                         throw new NullPointerException("beanHelper.user is null"); //NOI18N
400                 } else if (user.getUserId() == null) {
401                         // Throw NPE again
402                         throw new NullPointerException("beanHelper.user.userId is null"); //NOI18N
403                 } else if (user.getUserId() < 1) {
404                         // Invalid id
405                         throw new IllegalStateException(MessageFormat.format("beanHelper.user.userId={0} is invalid", user.getUserId())); //NOI18N
406                 } else if (this.getUserName() == null) {
407                         // Not all required fields are set
408                         throw new NullPointerException("this.userName is null"); //NOI18N
409                 } else if (this.getUserName().isEmpty()) {
410                         // Not all required fields are set
411                         throw new IllegalArgumentException("this.userName is empty"); //NOI18N
412                 } else if (((!this.getUserPassword().isEmpty()) || (!this.getUserPasswordRepeat().isEmpty())) && (!this.isSamePasswordEntered())) {
413                         // Clear password fields
414                         this.setUserPassword(null);
415                         this.setUserPasswordRepeat(null);
416
417                         // Not same password entered
418                         this.showFacesMessage("form_edit_user:userPassword", "ADMIN_USER_PASSWORD_REPEAT_DIFFERENT"); //NOI18N
419                         return ""; //NOI18N
420                 } else if ((!Objects.equals(user.getUserName(), this.getUserName())) && (this.userBean.ifUserNameExists(this.getUserName()))) {
421                         // Clear all fields
422                         this.clear();
423
424                         // User name already exists
425                         this.showFacesMessage("form_edit_user:userName", "ADMIN_USER_NAME_ALREADY_EXISTS"); //NOI18N
426                         return ""; //NOI18N
427                 } else if (this.isSamePasswordEntered()) {
428                         // Same password entered, create container
429                         if ((Objects.equals(user.getUserMustChangePassword(), this.getUserMustChangePassword())) && (UserUtils.ifPasswordMatches(new UserLoginContainer(user, this.getUserPassword())))) {
430                                 // Clear password fields
431                                 this.setUserPassword(null);
432                                 this.setUserPasswordRepeat(null);
433
434                                 // Same password entered
435                                 this.showFacesMessage("form_edit_user:userPassword", "ADMIN_USER_ENTERED_SAME_AS_OLD_PASSWORD"); //NOI18N
436                                 return ""; //NOI18N
437                         }
438
439                         // Encrypt password
440                         encryptedPassword = UserUtils.encryptPassword(this.getUserPassword());
441                 }
442
443                 // Set user name and flag
444                 user.setUserName(this.getUserName());
445                 user.setUserMustChangePassword(this.getUserMustChangePassword());
446
447                 // Is a password set?
448                 if (encryptedPassword != null) {
449                         // Set it as well
450                         user.setUserEncryptedPassword(encryptedPassword);
451                 }
452
453                 // Call EJB for updating user data
454                 User updatedUser = this.userBean.updateUserData(user);
455
456                 // Fire event
457                 this.updatedUserDataEvent.fire(new AdminUpdatedUserDataEvent(updatedUser));
458
459                 // Return to user list (for now)
460                 return "admin_list_user"; //NOI18N
461         }
462
463         @Override
464         public String getUserDeleteReason () {
465                 return this.userDeleteReason;
466         }
467
468         @Override
469         public void setUserDeleteReason (final String userDeleteReason) {
470                 this.userDeleteReason = userDeleteReason;
471         }
472
473         @Override
474         public String getUserLockReason () {
475                 return this.userLockReason;
476         }
477
478         @Override
479         public void setUserLockReason (final String userLockReason) {
480                 this.userLockReason = userLockReason;
481         }
482
483         @Override
484         public Boolean getUserMustChangePassword () {
485                 return this.userMustChangePassword;
486         }
487
488         @Override
489         public void setUserMustChangePassword (final Boolean userMustChangePassword) {
490                 this.userMustChangePassword = userMustChangePassword;
491         }
492
493         @Override
494         public String getUserName () {
495                 return this.userName;
496         }
497
498         @Override
499         public void setUserName (final String userName) {
500                 this.userName = userName;
501         }
502
503         @Override
504         public String getUserPassword () {
505                 return this.userPassword;
506         }
507
508         @Override
509         public void setUserPassword (final String userPassword) {
510                 this.userPassword = userPassword;
511         }
512
513         @Override
514         public String getUserPasswordRepeat () {
515                 return this.userPasswordRepeat;
516         }
517
518         @Override
519         public void setUserPasswordRepeat (final String userPasswordRepeat) {
520                 this.userPasswordRepeat = userPasswordRepeat;
521         }
522
523         /**
524          * Post-construction method
525          */
526         @PostConstruct
527         public void init () {
528                 // Try it
529                 try {
530                         // Get initial context
531                         Context context = new InitialContext();
532
533                         // Try to lookup
534                         this.userBean = (UserSessionBeanRemote) context.lookup("java:global/jjobs-ejb/user!org.mxchange.jusercore.model.user.UserSessionBeanRemote"); //NOI18N
535                         this.adminUserBean = (AdminUserSessionBeanRemote) context.lookup("java:global/jjobs-ejb/adminUser!org.mxchange.jusercore.model.user.AdminUserSessionBeanRemote"); //NOI18N
536                 } catch (final NamingException e) {
537                         // Throw again
538                         throw new FaceletException(e);
539                 }
540         }
541
542         @Override
543         public String lockUserAccount (final User user) {
544                 // Is the user instance valid and CONFIRMED?
545                 if (null == user) {
546                         // Throw NPE
547                         throw new NullPointerException("user is null"); //NOI18N
548                 } else if (user.getUserId() == null) {
549                         // Throw again
550                         throw new NullPointerException("user.userId is null"); //NOI18N
551                 } else if (user.getUserId() < 1) {
552                         // Invalid id number
553                         throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is not valid", user.getUserId())); //NOI18N
554                 } else if (user.getUserAccountStatus() == UserAccountStatus.LOCKED) {
555                         // User account is locked
556                         throw new FacesException(new UserStatusLockedException(user));
557                 } else if (user.getUserAccountStatus() == UserAccountStatus.UNCONFIRMED) {
558                         // User account is locked
559                         throw new FaceletException(new UserStatusUnconfirmedException(user));
560                 } else if (this.getUserLockReason() == null) {
561                         // Throw NPE again
562                         throw new NullPointerException("this.userLockReason is null"); //NOI18N
563                 } else if (this.getUserLockReason().isEmpty()) {
564                         // Empty lock reason
565                         throw new IllegalArgumentException("this.userLockReason is empty"); //NOI18N
566                 }
567
568                 // Init updated user instance
569                 User updatedUser;
570
571                 try {
572                         // Get base URL
573                         String baseUrl = FacesUtils.generateBaseUrl();
574
575                         // Call EJB to lock account
576                         updatedUser = this.adminUserBean.lockUserAccount(user, this.getUserLockReason(), baseUrl);
577                 } catch (final UserStatusLockedException | UserStatusUnconfirmedException | UserNotFoundException ex) {
578                         // Throw again
579                         throw new FaceletException(ex);
580                 }
581
582                 // Fire event
583                 this.userLockedEvent.fire(new AdminLockedUserEvent(updatedUser));
584
585                 // Clear bean
586                 this.clear();
587
588                 // Should go fine at this point, redirect to user profile
589                 return "admin_show_user"; //NOI18N
590         }
591
592         @Override
593         public String unlockUserAccount (final User user) {
594                 // Is the user instance valid and CONFIRMED?
595                 if (null == user) {
596                         // Throw NPE
597                         throw new NullPointerException("user is null"); //NOI18N
598                 } else if (user.getUserId() == null) {
599                         // Throw again
600                         throw new NullPointerException("user.userId is null"); //NOI18N
601                 } else if (user.getUserId() < 1) {
602                         // Invalid id number
603                         throw new IllegalArgumentException(MessageFormat.format("user.userId={0} is not valid", user.getUserId())); //NOI18N
604                 } else if (user.getUserAccountStatus() == UserAccountStatus.CONFIRMED) {
605                         // User account is locked
606                         throw new FacesException(new UserStatusConfirmedException(user));
607                 } else if (user.getUserAccountStatus() == UserAccountStatus.UNCONFIRMED) {
608                         // User account is locked
609                         throw new FaceletException(new UserStatusUnconfirmedException(user));
610                 }
611
612                 // Init updated user instance
613                 User updatedUser;
614
615                 try {
616                         // Get base URL
617                         String baseUrl = FacesUtils.generateBaseUrl();
618
619                         // Call EJB to unlock account
620                         updatedUser = this.adminUserBean.unlockUserAccount(user, baseUrl);
621                 } catch (final UserStatusConfirmedException | UserStatusUnconfirmedException | UserNotFoundException ex) {
622                         // Throw again
623                         throw new FaceletException(ex);
624                 }
625
626                 // Fire event
627                 this.userUnlockedEvent.fire(new AdminUnlockedUserEvent(updatedUser));
628
629                 // Clear bean
630                 this.clear();
631
632                 // Should go fine at this point, redirect to user profile
633                 return "admin_show_user"; //NOI18N
634         }
635
636         /**
637          * Clears this bean
638          */
639         private void clear () {
640                 // Clear all data
641                 // - other data
642                 this.setUserName(null);
643                 this.setUserPassword(null);
644                 this.setUserPasswordRepeat(null);
645                 this.setUserMustChangePassword(null);
646         }
647
648         /**
649          * Checks if same password is entered and that they are not empty.
650          * <p>
651          * @return Whether the same password was entered
652          */
653         private boolean isSamePasswordEntered () {
654                 return ((!this.getUserPassword().isEmpty()) && (Objects.equals(this.getUserPassword(), this.getUserPasswordRepeat())));
655         }
656
657 }