private User user;
/**
- * Unencrypted password
+ * Clear-text password
*/
private String userPassword;
/**
- * Constructor with user instance and unencrypted password
+ * Constructor with user instance and clear-text password
* <p>
* @param user User instance
- * @param userPassword Unencrypted password
+ * @param userPassword Clear-text password
*/
public UserLoginContainer (final User user, final String userPassword) {
// Is both set?
/**
* Checks if direct password the updatedUser's password
* <p>
- * @param unencryptedPassword Clear-text (direct) password
+ * @param clear-textPassword Clear-text (direct) password
* @param updatedUser Updated user instance from database
* <p>
* @return Whether the password matches
*/
- public static boolean ifPasswordMatches (final String unencryptedPassword, final User updatedUser) {
+ public static boolean ifPasswordMatches (final String clear-textPassword, final User updatedUser) {
// Validate parameters
- if (null == unencryptedPassword) {
+ if (null == clear-textPassword) {
// Throw NPE
- throw new NullPointerException("unencryptedPassword is null"); //NOI18N
- } else if (unencryptedPassword.isEmpty()) {
+ throw new NullPointerException("clear-textPassword is null"); //NOI18N
+ } else if (clear-textPassword.isEmpty()) {
// NPE for user in container
- throw new NullPointerException("unencryptedPassword is empty."); //NOI18N
+ throw new NullPointerException("clear-textPassword is empty."); //NOI18N
} else if (null == updatedUser) {
// And again NPE ...
throw new NullPointerException("updatedUser is null"); //NOI18N
}
// First encrypt password
- String encryptedPassword = Crypt.crypt(unencryptedPassword, updatedUser.getUserEncryptedPassword());
+ String encryptedPassword = Crypt.crypt(clear-textPassword, updatedUser.getUserEncryptedPassword());
// Is it matching?
return encryptedPassword.equals(updatedUser.getUserEncryptedPassword());
/**
* Checks if password from container matches with from user instance.
* <p>
- * @param container Container holding user instance and unencrypted password
+ * @param container Container holding user instance and clear-text password
* <p>
* @return Whether it maches
*/