|
|
@@ -29,6 +29,7 @@ module.exports = function(crowi) {
|
|
|
introduction: { type: String },
|
|
|
password: String,
|
|
|
apiToken: String,
|
|
|
+ language: {type: String, enum: ['en', 'ja'], default: 'en'},
|
|
|
status: { type: Number, required: true, default: STATUS_ACTIVE, index: true },
|
|
|
createdAt: { type: Date, default: Date.now },
|
|
|
admin: { type: Boolean, default: 0, index: true }
|
|
|
@@ -94,9 +95,11 @@ module.exports = function(crowi) {
|
|
|
return false;
|
|
|
};
|
|
|
|
|
|
- userSchema.methods.update = function(name, email, callback) {
|
|
|
+ userSchema.methods.update = function(name, email, language, callback) {
|
|
|
this.name = name;
|
|
|
this.email = email;
|
|
|
+ this.language = language;
|
|
|
+
|
|
|
this.save(function(err, userData) {
|
|
|
return callback(err, userData);
|
|
|
});
|
|
|
@@ -532,7 +535,7 @@ module.exports = function(crowi) {
|
|
|
);
|
|
|
};
|
|
|
|
|
|
- userSchema.statics.createUserByEmailAndPassword = function(name, username, email, password, callback) {
|
|
|
+ userSchema.statics.createUserByEmailAndPassword = function(name, username, email, password, language, callback) {
|
|
|
var User = this
|
|
|
, newUser = new User();
|
|
|
|
|
|
@@ -540,6 +543,7 @@ module.exports = function(crowi) {
|
|
|
newUser.username = username;
|
|
|
newUser.email = email;
|
|
|
newUser.setPassword(password);
|
|
|
+ newUser.language = language;
|
|
|
newUser.createdAt = Date.now();
|
|
|
newUser.status = decideUserStatusOnRegistration();
|
|
|
|