diff --git a/back/models/vn-user.js b/back/models/vn-user.js index 05102478c..710710e4e 100644 --- a/back/models/vn-user.js +++ b/back/models/vn-user.js @@ -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; diff --git a/front/core/services/auth.js b/front/core/services/auth.js index 0b89a8e88..41cd27f03 100644 --- a/front/core/services/auth.js +++ b/front/core/services/auth.js @@ -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) { diff --git a/front/salix/components/change-password/index.js b/front/salix/components/change-password/index.js index 4462b9221..9b1f748b7 100644 --- a/front/salix/components/change-password/index.js +++ b/front/salix/components/change-password/index.js @@ -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 }); diff --git a/front/salix/components/login/index.js b/front/salix/components/login/index.js index d248f56a3..74828dd9b 100644 --- a/front/salix/components/login/index.js +++ b/front/salix/components/login/index.js @@ -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; }); } diff --git a/front/salix/routes.js b/front/salix/routes.js index f32c143ef..c649236a3 100644 --- a/front/salix/routes.js +++ b/front/salix/routes.js @@ -33,6 +33,12 @@ function config($stateProvider, $urlRouterProvider) { description: 'Reset password', template: '' }) + .state('change-password', { + parent: 'outLayout', + url: '/change-password', + description: 'Change password', + template: '' + }) .state('home', { parent: 'layout', url: '/', diff --git a/loopback/server/boot/set-password.js b/loopback/server/boot/set-password.js deleted file mode 100644 index ae4dc30ea..000000000 --- a/loopback/server/boot/set-password.js +++ /dev/null @@ -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); - }; -};