forked from Archives/Athou_commafeed
save when users were created
This commit is contained in:
@@ -41,6 +41,9 @@ public class User extends AbstractModel {
|
|||||||
@Temporal(TemporalType.TIMESTAMP)
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
private Date lastLogin;
|
private Date lastLogin;
|
||||||
|
|
||||||
|
@Temporal(TemporalType.TIMESTAMP)
|
||||||
|
private Date created;
|
||||||
|
|
||||||
@Column(length = 40)
|
@Column(length = 40)
|
||||||
private String recoverPasswordToken;
|
private String recoverPasswordToken;
|
||||||
|
|
||||||
@@ -51,7 +54,7 @@ public class User extends AbstractModel {
|
|||||||
CascadeType.REMOVE })
|
CascadeType.REMOVE })
|
||||||
private Set<UserRole> roles = Sets.newHashSet();
|
private Set<UserRole> roles = Sets.newHashSet();
|
||||||
|
|
||||||
@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
|
@OneToMany(mappedBy = "user", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
|
||||||
private Set<FeedSubscription> subscriptions;
|
private Set<FeedSubscription> subscriptions;
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
@@ -142,4 +145,12 @@ public class User extends AbstractModel {
|
|||||||
this.subscriptions = subscriptions;
|
this.subscriptions = subscriptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Date getCreated() {
|
||||||
|
return created;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreated(Date created) {
|
||||||
|
this.created = created;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ public class UserService {
|
|||||||
byte[] salt = encryptionService.generateSalt();
|
byte[] salt = encryptionService.generateSalt();
|
||||||
user.setName(name);
|
user.setName(name);
|
||||||
user.setEmail(email);
|
user.setEmail(email);
|
||||||
|
user.setCreated(Calendar.getInstance().getTime());
|
||||||
user.setSalt(salt);
|
user.setSalt(salt);
|
||||||
user.setPassword(encryptionService.getEncryptedPassword(password, salt));
|
user.setPassword(encryptionService.getEncryptedPassword(password, salt));
|
||||||
for (Role role : roles) {
|
for (Role role : roles) {
|
||||||
|
|||||||
@@ -217,4 +217,11 @@
|
|||||||
<sql>update USERSETTINGS set user_lang='nb' where user_lang='no'</sql>
|
<sql>update USERSETTINGS set user_lang='nb' where user_lang='no'</sql>
|
||||||
</changeSet>
|
</changeSet>
|
||||||
|
|
||||||
|
<changeSet author="athou" id="add-user-created">
|
||||||
|
<addColumn tableName="USERS">
|
||||||
|
<column name="created" type="DATETIME" />
|
||||||
|
</addColumn>
|
||||||
|
<sql>update USERS set created = lastLogin</sql>
|
||||||
|
</changeSet>
|
||||||
|
|
||||||
</databaseChangeLog>
|
</databaseChangeLog>
|
||||||
|
|||||||
Reference in New Issue
Block a user