refs #5472 feat(vnUser): override setPassword
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
This commit is contained in:
parent
bf3aac70f3
commit
5eca583c62
|
@ -108,6 +108,15 @@ module.exports = function(Self) {
|
|||
return email.send();
|
||||
});
|
||||
|
||||
const _setPassword = Self.setPassword;
|
||||
Self.setPassword = async function(id, newPassword, options, cb) {
|
||||
// await Self.rawSql(`CALL account.user_checkPassword(?)`, [newPassword]);
|
||||
await _setPassword.call(this, id, newPassword, options, cb);
|
||||
const user = await Self.findById(id);
|
||||
await user.updateAttribute('passExpired', null);
|
||||
return;
|
||||
};
|
||||
|
||||
// FIX THIS
|
||||
Self.afterRemote('prototype.patchAttributes', async(ctx, instance) => {
|
||||
if (!ctx.args || !ctx.args.data.email) return;
|
||||
|
|
|
@ -24,7 +24,7 @@ export default class Auth {
|
|||
initialize() {
|
||||
let criteria = {
|
||||
to: state => {
|
||||
const outLayout = ['login', 'recover-password', 'reset-password'];
|
||||
const outLayout = ['login', 'recover-password', 'reset-password', 'change-password'];
|
||||
return !outLayout.some(ol => ol == state.name);
|
||||
}
|
||||
};
|
||||
|
@ -59,8 +59,8 @@ export default class Auth {
|
|||
password: password || undefined
|
||||
};
|
||||
|
||||
return this.$http.post('VnUsers/signIn', params).then(
|
||||
json => this.onLoginOk(json, remember));
|
||||
return this.$http.post('VnUsers/signIn', params)
|
||||
.then(json => this.onLoginOk(json, remember));
|
||||
}
|
||||
|
||||
onLoginOk(json, remember) {
|
||||
|
|
|
@ -43,7 +43,7 @@ export default class Controller {
|
|||
}
|
||||
Controller.$inject = ['$scope', '$element', '$http', 'vnApp', '$translate', '$state', '$location'];
|
||||
|
||||
ngModule.vnComponent('vnResetPassword', {
|
||||
ngModule.vnComponent('vnChangePassword', {
|
||||
template: require('./index.html'),
|
||||
controller: Controller
|
||||
});
|
||||
|
|
|
@ -28,7 +28,8 @@ export default class Controller {
|
|||
this.focusUser();
|
||||
console.log('hola');
|
||||
console.log(err);
|
||||
console.log(err.error);
|
||||
console.log(err.message);
|
||||
console.log(err.stack);
|
||||
throw err;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -33,6 +33,12 @@ function config($stateProvider, $urlRouterProvider) {
|
|||
description: 'Reset password',
|
||||
template: '<vn-reset-password></vn-reset-password>'
|
||||
})
|
||||
.state('change-password', {
|
||||
parent: 'outLayout',
|
||||
url: '/change-password',
|
||||
description: 'Change password',
|
||||
template: '<vn-change-password></vn-change-password>'
|
||||
})
|
||||
.state('home', {
|
||||
parent: 'layout',
|
||||
url: '/',
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
// SET IN VN_USER
|
||||
module.exports = async function(app) {
|
||||
const _setPassword = app.models.VnUser.setPassword;
|
||||
app.models.VnUser.setPassword = function(newPassword, options, cb) {
|
||||
return _setPassword.call(this, newPassword, options, cb);
|
||||
};
|
||||
};
|
Loading…
Reference in New Issue