Add REST service for reseting user password.
This commit is contained in:
@@ -20,12 +20,13 @@ package com.wisemapping.service;
|
||||
|
||||
import com.wisemapping.model.User;
|
||||
import com.wisemapping.exceptions.WiseMappingException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface UserService {
|
||||
|
||||
public void activateAcount(long code) throws InvalidActivationCodeException;
|
||||
public void activateAccount(long code) throws InvalidActivationCodeException;
|
||||
|
||||
public void createUser(User user, boolean emailConfirmEnabled) throws WiseMappingException;
|
||||
public User createUser(@NotNull User user, boolean emailConfirmEnabled) throws WiseMappingException;
|
||||
|
||||
public void changePassword(User user);
|
||||
|
||||
@@ -40,4 +41,6 @@ public interface UserService {
|
||||
public void sendEmailPassword(String email) throws InvalidUserEmailException;
|
||||
|
||||
public User reloadUser(final User user);
|
||||
|
||||
public void deleteUser(@NotNull User user);
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@ import com.wisemapping.mail.Mailer;
|
||||
import com.wisemapping.model.Collaborator;
|
||||
import com.wisemapping.model.User;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
@@ -37,7 +38,7 @@ public class UserServiceImpl
|
||||
private Mailer mailer;
|
||||
final static Logger logger = Logger.getLogger("org.wisemapping.service");
|
||||
|
||||
public void activateAcount(long code)
|
||||
public void activateAccount(long code)
|
||||
throws InvalidActivationCodeException {
|
||||
final User user = userManager.getUserByActivationCode(code);
|
||||
if (user == null || user.isActive()) {
|
||||
@@ -90,7 +91,11 @@ public class UserServiceImpl
|
||||
return lo + i;
|
||||
}
|
||||
|
||||
public void createUser(User user, boolean emailConfirmEnabled) throws WiseMappingException {
|
||||
public void deleteUser(@NotNull User user){
|
||||
userManager.deleteUser(user);
|
||||
}
|
||||
|
||||
public User createUser(@NotNull User user, boolean emailConfirmEnabled) throws WiseMappingException {
|
||||
final UUID uuid = UUID.randomUUID();
|
||||
user.setCreationDate(Calendar.getInstance());
|
||||
user.setActivationCode(uuid.getLeastSignificantBits());
|
||||
@@ -116,6 +121,7 @@ public class UserServiceImpl
|
||||
if (emailConfirmEnabled) {
|
||||
sendRegistrationEmail(user);
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
private void sendRegistrationEmail(User user) {
|
||||
|
Reference in New Issue
Block a user