1
0
Fork 0
mirror of synced 2024-10-02 01:56:57 +13:00

Making sure roles object is always present, issue #1529.

This commit is contained in:
mike12345567 2021-05-21 14:56:06 +01:00
parent 96ad77b41d
commit b71d751243

View file

@ -42,6 +42,10 @@ exports.save = async ctx => {
_id: _id || generateGlobalUserID(),
password: hashedPassword,
}
// make sure the roles object is always present
if (!user.roles) {
user.roles = {}
}
// add the active status to a user if its not provided
if (user.status == null) {
user.status = UserStatus.ACTIVE