2020-11-12 22:20:25 +00:00
|
|
|
|
|
|
|
const app = require('vn-loopback/server/server');
|
|
|
|
|
|
|
|
module.exports = Self => {
|
2023-11-20 17:39:37 +00:00
|
|
|
Self.getLinker = async function() {
|
2020-11-12 22:20:25 +00:00
|
|
|
return await Self.findOne({fields: ['id']});
|
|
|
|
};
|
|
|
|
|
|
|
|
Object.assign(Self.prototype, {
|
|
|
|
async syncUser(userName, info, password) {
|
|
|
|
if (!info.hasAccount || !password) return;
|
|
|
|
|
2023-01-23 14:24:00 +00:00
|
|
|
await app.models.VnUser.rawSql('CALL pbx.sip_setPassword(?, ?)',
|
2020-11-12 22:20:25 +00:00
|
|
|
[info.user.id, password]
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|