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();
|
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
|
// FIX THIS
|
||||||
Self.afterRemote('prototype.patchAttributes', async(ctx, instance) => {
|
Self.afterRemote('prototype.patchAttributes', async(ctx, instance) => {
|
||||||
if (!ctx.args || !ctx.args.data.email) return;
|
if (!ctx.args || !ctx.args.data.email) return;
|
||||||
|
|
|
@ -24,7 +24,7 @@ export default class Auth {
|
||||||
initialize() {
|
initialize() {
|
||||||
let criteria = {
|
let criteria = {
|
||||||
to: state => {
|
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);
|
return !outLayout.some(ol => ol == state.name);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -59,8 +59,8 @@ export default class Auth {
|
||||||
password: password || undefined
|
password: password || undefined
|
||||||
};
|
};
|
||||||
|
|
||||||
return this.$http.post('VnUsers/signIn', params).then(
|
return this.$http.post('VnUsers/signIn', params)
|
||||||
json => this.onLoginOk(json, remember));
|
.then(json => this.onLoginOk(json, remember));
|
||||||
}
|
}
|
||||||
|
|
||||||
onLoginOk(json, remember) {
|
onLoginOk(json, remember) {
|
||||||
|
|
|
@ -43,7 +43,7 @@ export default class Controller {
|
||||||
}
|
}
|
||||||
Controller.$inject = ['$scope', '$element', '$http', 'vnApp', '$translate', '$state', '$location'];
|
Controller.$inject = ['$scope', '$element', '$http', 'vnApp', '$translate', '$state', '$location'];
|
||||||
|
|
||||||
ngModule.vnComponent('vnResetPassword', {
|
ngModule.vnComponent('vnChangePassword', {
|
||||||
template: require('./index.html'),
|
template: require('./index.html'),
|
||||||
controller: Controller
|
controller: Controller
|
||||||
});
|
});
|
||||||
|
|
|
@ -28,7 +28,8 @@ export default class Controller {
|
||||||
this.focusUser();
|
this.focusUser();
|
||||||
console.log('hola');
|
console.log('hola');
|
||||||
console.log(err);
|
console.log(err);
|
||||||
console.log(err.error);
|
console.log(err.message);
|
||||||
|
console.log(err.stack);
|
||||||
throw err;
|
throw err;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,12 @@ function config($stateProvider, $urlRouterProvider) {
|
||||||
description: 'Reset password',
|
description: 'Reset password',
|
||||||
template: '<vn-reset-password></vn-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', {
|
.state('home', {
|
||||||
parent: 'layout',
|
parent: 'layout',
|
||||||
url: '/',
|
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