Changed variable name password to hashedPassword for encrypted password
[staff/due1/sed-hs15-srs-purple.git] / src / main / java / ch / bfh / ti / srs / core / User.java
index e964628..e62158d 100644 (file)
@@ -12,7 +12,7 @@ import ch.bfh.ti.srs.extern.Password;
 public class User {
 
        private final String userName;
-       private String password;
+       private String hashedPassword;
        private String mail;
        private String name;
        private String lastname;
@@ -28,9 +28,9 @@ public class User {
         * @param lastname              Lastname
         */
        //TODO: Change constructor to package when DataHandlerForExcel is moved back to this package
-       public User(String userName, String password, String mail, String name, String lastname){
+       public User(String userName, String hashedPassword, String mail, String name, String lastname){
                this.userName = userName;
-               this.password = password;
+               this.hashedPassword = hashedPassword;
                this.mail = mail;
                this.name = name;
                this.lastname = lastname;
@@ -49,7 +49,7 @@ public class User {
                if(password == null) throw new IllegalArgumentException("Password must not be null");
 
                this.userName = userName;
-               this.password = Password.getSaltedHash(password);
+               this.hashedPassword = Password.getSaltedHash(password);
        }
 
        //Getter
@@ -70,7 +70,7 @@ public class User {
        }
        
        public String getEncryptedPassword(){
-               return password;
+               return hashedPassword;
        }
        
        //Setter
@@ -96,13 +96,13 @@ public class User {
        //Password methods
        public boolean checkPassword(String password) throws Exception{
                if(password == null) throw new IllegalArgumentException("Password must not be null");
-               return Password.check(password, this.password);
+               return Password.check(password, this.hashedPassword);
        }
 
        public void changePassword(String newPassword) throws Exception{
                if(newPassword == null) throw new IllegalArgumentException("Password must not be null");
                if(checkPassword(newPassword)) throw new IllegalArgumentException("Can not be the current password");
-               this.password = Password.getSaltedHash(newPassword);
+               this.hashedPassword = Password.getSaltedHash(newPassword);
        }