|
|
@@ -245,10 +245,16 @@ module.exports = function(crowi) {
|
|
|
|
|
|
userSchema.methods.statusDelete = function(callback) {
|
|
|
debug('Delete User', this);
|
|
|
+
|
|
|
+ const now = new Date();
|
|
|
+
|
|
|
this.status = STATUS_DELETED;
|
|
|
+ this.username = `deleted_at_${now.getTime()}`;
|
|
|
this.password = '';
|
|
|
+ this.name = '';
|
|
|
this.email = 'deleted@deleted';
|
|
|
this.googleId = null;
|
|
|
+ this.isGravatarEnabled = false;
|
|
|
this.image = null;
|
|
|
this.save(function(err, userData) {
|
|
|
return callback(err, userData);
|
|
|
@@ -383,7 +389,7 @@ module.exports = function(crowi) {
|
|
|
userSchema.statics.findUsersWithPagination = function(options, callback) {
|
|
|
var sort = options.sort || {status: 1, username: 1, createdAt: 1};
|
|
|
|
|
|
- this.paginate({}, { page: options.page || 1, limit: options.limit || PAGE_ITEMS }, function(err, result) {
|
|
|
+ this.paginate({status: { $ne: STATUS_DELETED }}, { page: options.page || 1, limit: options.limit || PAGE_ITEMS }, function(err, result) {
|
|
|
if (err) {
|
|
|
debug('Error on pagination:', err);
|
|
|
return callback(err, null);
|
|
|
@@ -581,7 +587,6 @@ module.exports = function(crowi) {
|
|
|
|
|
|
newUser.email = email;
|
|
|
newUser.setPassword(password);
|
|
|
- newUser.isGravatarEnabled = true; // Gravatar enabled in default
|
|
|
newUser.createdAt = Date.now();
|
|
|
newUser.status = STATUS_INVITED;
|
|
|
|
|
|
@@ -658,7 +663,6 @@ module.exports = function(crowi) {
|
|
|
newUser.email = email;
|
|
|
newUser.setPassword(password);
|
|
|
newUser.lang = lang;
|
|
|
- newUser.isGravatarEnabled = false;
|
|
|
newUser.createdAt = Date.now();
|
|
|
newUser.status = decideUserStatusOnRegistration();
|
|
|
|