code cleanup
This commit is contained in:
parent
60699ed847
commit
614a929592
@ -1,10 +1,7 @@
|
|||||||
package org.hso.ecommerce.action.user;
|
package org.hso.ecommerce.action.user;
|
||||||
|
|
||||||
import com.sun.xml.bind.v2.TODO;
|
|
||||||
import org.hibernate.sql.Update;
|
|
||||||
import org.hso.ecommerce.entities.user.User;
|
import org.hso.ecommerce.entities.user.User;
|
||||||
import org.hso.ecommerce.repos.user.UserRepository;
|
import org.hso.ecommerce.repos.user.UserRepository;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
|
|
||||||
public class UpdateUserSettingsAction {
|
public class UpdateUserSettingsAction {
|
||||||
|
|
||||||
@ -30,8 +27,7 @@ public class UpdateUserSettingsAction {
|
|||||||
|
|
||||||
public UpdateResult updatePassword(String oldPassword, String password1, String password2) {
|
public UpdateResult updatePassword(String oldPassword, String password1, String password2) {
|
||||||
UpdateResult result = new UpdateResult(false);
|
UpdateResult result = new UpdateResult(false);
|
||||||
if(this.user.validatePassword(oldPassword))
|
if (this.user.validatePassword(oldPassword)) {
|
||||||
{
|
|
||||||
if (password1.equals(password2)) {
|
if (password1.equals(password2)) {
|
||||||
if (!password1.equals(oldPassword)) {
|
if (!password1.equals(oldPassword)) {
|
||||||
this.user.setPassword(password1);
|
this.user.setPassword(password1);
|
||||||
|
@ -44,10 +44,6 @@ public class User {
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEmail(String email) {
|
|
||||||
this.email = email;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean validatePassword(String password) {
|
public boolean validatePassword(String password) {
|
||||||
return BCrypt.checkpw(password, passwordHash);
|
return BCrypt.checkpw(password, passwordHash);
|
||||||
}
|
}
|
||||||
|
@ -14,4 +14,3 @@ public interface CustomerOrderRepository extends JpaRepository<CustomerOrder, Lo
|
|||||||
List<CustomerOrder> getOrdersByUserId(long userId);
|
List<CustomerOrder> getOrdersByUserId(long userId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user