mirror of
https://github.com/sismics/docs.git
synced 2024-11-22 05:57:57 +01:00
cleanup user creation
This commit is contained in:
parent
99d44f2a92
commit
4aca4ad495
@ -6,6 +6,7 @@ import com.sismics.docs.core.dao.jpa.criteria.UserCriteria;
|
||||
import com.sismics.docs.core.dao.jpa.dto.UserDto;
|
||||
import com.sismics.docs.core.model.jpa.User;
|
||||
import com.sismics.docs.core.util.AuditLogUtil;
|
||||
import com.sismics.docs.core.util.EncryptionUtil;
|
||||
import com.sismics.docs.core.util.jpa.QueryParam;
|
||||
import com.sismics.docs.core.util.jpa.QueryUtil;
|
||||
import com.sismics.docs.core.util.jpa.SortCriteria;
|
||||
@ -71,6 +72,8 @@ public class UserDao {
|
||||
// Create the user
|
||||
user.setCreateDate(new Date());
|
||||
user.setPassword(hashPassword(user.getPassword()));
|
||||
user.setPrivateKey(EncryptionUtil.generatePrivateKey());
|
||||
user.setStorageCurrent(0L);
|
||||
em.persist(user);
|
||||
|
||||
// Create audit log
|
||||
|
@ -22,9 +22,7 @@ public class TestJpa extends BaseTransactionalTest {
|
||||
user.setPassword("12345678");
|
||||
user.setEmail("toto@docs.com");
|
||||
user.setRoleId("admin");
|
||||
user.setStorageCurrent(0l);
|
||||
user.setStorageQuota(10l);
|
||||
user.setPrivateKey("AwesomePrivateKey");
|
||||
user.setStorageQuota(10L);
|
||||
String id = userDao.create(user, "me");
|
||||
|
||||
TransactionUtil.commit();
|
||||
|
@ -15,7 +15,6 @@ import com.sismics.docs.core.event.PasswordLostEvent;
|
||||
import com.sismics.docs.core.model.context.AppContext;
|
||||
import com.sismics.docs.core.model.jpa.*;
|
||||
import com.sismics.docs.core.util.ConfigUtil;
|
||||
import com.sismics.docs.core.util.EncryptionUtil;
|
||||
import com.sismics.docs.core.util.authentication.AuthenticationUtil;
|
||||
import com.sismics.docs.core.util.jpa.SortCriteria;
|
||||
import com.sismics.docs.rest.constant.BaseFunction;
|
||||
@ -100,10 +99,7 @@ public class UserResource extends BaseResource {
|
||||
user.setPassword(password);
|
||||
user.setEmail(email);
|
||||
user.setStorageQuota(storageQuota);
|
||||
user.setStorageCurrent(0L);
|
||||
user.setPrivateKey(EncryptionUtil.generatePrivateKey());
|
||||
user.setCreateDate(new Date());
|
||||
|
||||
|
||||
// Create the user
|
||||
UserDao userDao = new UserDao();
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user