refs #5472 feat(out_login): change-password
gitea/salix/pipeline/head There was a failure building this commit
Details
gitea/salix/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
2da4289695
commit
728ef965c4
|
@ -110,8 +110,9 @@ module.exports = function(Self) {
|
||||||
|
|
||||||
const _setPassword = Self.setPassword;
|
const _setPassword = Self.setPassword;
|
||||||
Self.setPassword = async function(id, newPassword, options, cb) {
|
Self.setPassword = async function(id, newPassword, options, cb) {
|
||||||
// await Self.rawSql(`CALL account.user_setPassword(?, ?)`,
|
await Self.rawSql(`CALL account.user_setPassword(?, ?)`,
|
||||||
// [id, newPassword]);
|
[id, newPassword]);
|
||||||
|
console.log('Entry in override SET_PASSWORD');
|
||||||
await Self.app.models.Account.syncById(id, newPassword);
|
await Self.app.models.Account.syncById(id, newPassword);
|
||||||
await _setPassword.call(this, id, newPassword, options, cb);
|
await _setPassword.call(this, id, newPassword, options, cb);
|
||||||
|
|
||||||
|
@ -121,10 +122,11 @@ module.exports = function(Self) {
|
||||||
};
|
};
|
||||||
|
|
||||||
const _changePassword = Self.changePassword;
|
const _changePassword = Self.changePassword;
|
||||||
Self.changePassword = async function(id, oldPassword, newPassword, options, cb) {
|
Self.changePassword = async function(id = 9, oldPassword, newPassword, options, cb) {
|
||||||
// await Self.rawSql(`CALL account.user_changePassword(?, ?, ?)`,
|
console.log(id, oldPassword, newPassword);
|
||||||
// [id, oldPassword, newPassword]);
|
await Self.rawSql(`CALL account.user_changePassword(?, ?, ?)`,
|
||||||
await Self.app.models.Account.syncById(id, newPassword);
|
[id, oldPassword, newPassword]);
|
||||||
|
console.log('Entry in override CHANGE_PASSWORD');
|
||||||
await _changePassword.call(this, id, oldPassword, newPassword, options, cb);
|
await _changePassword.call(this, id, oldPassword, newPassword, options, cb);
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
|
@ -109,6 +109,13 @@
|
||||||
"principalType": "ROLE",
|
"principalType": "ROLE",
|
||||||
"principalId": "$everyone",
|
"principalId": "$everyone",
|
||||||
"permission": "ALLOW"
|
"permission": "ALLOW"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"property": "changePassword",
|
||||||
|
"accessType": "EXECUTE",
|
||||||
|
"principalType": "ROLE",
|
||||||
|
"principalId": "$everyone",
|
||||||
|
"permission": "ALLOW"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"property": "validateToken",
|
"property": "validateToken",
|
||||||
|
|
|
@ -23,6 +23,7 @@ export default class Controller {
|
||||||
|
|
||||||
submit() {
|
submit() {
|
||||||
const newPassword = this.newPassword;
|
const newPassword = this.newPassword;
|
||||||
|
const oldPassword = this.oldPassword;
|
||||||
|
|
||||||
if (!newPassword)
|
if (!newPassword)
|
||||||
throw new UserError(`You must enter a new password`);
|
throw new UserError(`You must enter a new password`);
|
||||||
|
@ -30,12 +31,12 @@ export default class Controller {
|
||||||
throw new UserError(`Passwords don't match`);
|
throw new UserError(`Passwords don't match`);
|
||||||
|
|
||||||
const headers = {
|
const headers = {
|
||||||
Authorization: this.$location.$$search.access_token
|
Authorization: {principalType: 'VnUser'}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$http.post('VnUsers/change-password', {newPassword}, {headers})
|
this.$http.post('VnUsers/change-password', {oldPassword, newPassword}, {headers})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.vnApp.showSuccess(this.$translate.instant('Password changed!'));
|
this.vnApp.showSuccess(this.$translate.instant('Password updated!'));
|
||||||
this.$state.go('login');
|
this.$state.go('login');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ Change password: Cambiar contraseña
|
||||||
Old password: Antigua contraseña
|
Old password: Antigua contraseña
|
||||||
New password: Nueva contraseña
|
New password: Nueva contraseña
|
||||||
Repeat password: Repetir contraseña
|
Repeat password: Repetir contraseña
|
||||||
Password changed!: ¡Contraseña actualizada!
|
Password updated!: ¡Contraseña actualizada!
|
||||||
Password requirements: >
|
Password requirements: >
|
||||||
La contraseña debe tener al menos {{ length }} caracteres de longitud,
|
La contraseña debe tener al menos {{ length }} caracteres de longitud,
|
||||||
{{nAlpha}} caracteres alfabéticos, {{nUpper}} letras mayúsculas, {{nDigits}}
|
{{nAlpha}} caracteres alfabéticos, {{nUpper}} letras mayúsculas, {{nDigits}}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import ngModule from '../../module';
|
import ngModule from '../../module';
|
||||||
import './style.scss';
|
import './style.scss';
|
||||||
|
import UserError from 'core/lib/user-error';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple login form.
|
* A simple login form.
|
||||||
|
@ -27,11 +28,13 @@ export default class Controller {
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.password = '';
|
this.password = '';
|
||||||
this.focusUser();
|
this.focusUser();
|
||||||
console.log(req.data.error);
|
// console.log(req.data.error);
|
||||||
console.log(req.data.error.code);
|
// console.log(req.data.error.code);
|
||||||
throw req;
|
|
||||||
if (req.data.error.code = 'passExpired')
|
if (req.data.error.code == 'passExpired')
|
||||||
this.$state.go('change-password');
|
this.$state.go('change-password');
|
||||||
|
|
||||||
|
throw req;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue