refactor: not use axios
gitea/salix/pipeline/head This commit is unstable Details

This commit is contained in:
Alex Moreno 2022-11-10 13:32:07 +01:00
parent 617e2d804f
commit 517422be8c
4 changed files with 18 additions and 10 deletions

View File

@ -20,8 +20,11 @@ module.exports = Self => {
try {
await models.user.resetPassword({email});
} catch (e) {
return;
} catch (err) {
if (err.code === 'EMAIL_NOT_FOUND')
return;
else
throw err;
}
};
};

View File

@ -0,0 +1,2 @@
DELETE FROM `salix`.`ACL`
WHERE model = 'UserPassword';

View File

@ -1,6 +1,5 @@
import ngModule from '../../module';
import './style.scss';
const axios = require('axios');
export default class Controller {
constructor($scope, $element, $http, vnApp, $translate, $state, $location) {
@ -16,11 +15,7 @@ export default class Controller {
}
$onInit() {
const headers = {
Authorization: this.$location.$$search.access_token
};
axios.post('api/UserPasswords/findOne', null, {headers})
this.$http.get('UserPasswords/findOne')
.then(res => {
this.passRequirements = res.data;
});
@ -38,7 +33,7 @@ export default class Controller {
const newPassword = this.newPassword;
axios.post('api/users/reset-password', {newPassword}, {headers})
this.$http.post('users/reset-password', {newPassword}, {headers})
.then(() => {
this.vnApp.showSuccess(this.$translate.instant('Password changed!'));
this.$state.go('login');

View File

@ -30,5 +30,13 @@
"type": "number",
"required": true
}
}
},
"acls": [
{
"accessType": "READ",
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "ALLOW"
}
]
}