diff --git a/front/salix/components/recover-password/index.html b/front/salix/components/recover-password/index.html
index 4348cb1eb..935ab497c 100644
--- a/front/salix/components/recover-password/index.html
+++ b/front/salix/components/recover-password/index.html
@@ -4,13 +4,6 @@
ng-model="$ctrl.user"
vn-focus>
-
{
Self.observe('before save', async function(ctx, next) {
if (ctx.isNewInstance) return;
- const isOwner = await checkModifyPermission(ctx);
+ const instanceId = ctx.currentInstance.id;
+ const userId = ctx.options.accessToken.userId;
+ const isOwner = instanceId === userId;
const phoneHasChanged = !!ctx.data.user?.recoveryPhone;
-
- const {models} = Self.app;
+ try {
+ await Self.app.models.VnUser.userSecurity(ctx, ctx.where.id);
+ } catch (error) {
+ throw new UserError('Phone can\'t be updated');
+ }
if (!isOwner) {
- if (phoneHasChanged)
- throw new UserError('Phone can\'t be updated');
- else {
+ if (phoneHasChanged) {
const {recoveryPhone} = ctx.data.user;
const {id} = ctx.currentInstance;
- await models.VnUser.updateAll({id}, {recoveryPhone});
+ await Self.app.models.VnUser.updateAll({id}, {recoveryPhone});
ctx.data.code = ctx.currentInstance.code;
}
}
delete ctx.data.user;
});
- async function checkModifyPermission(ctx) {
- const instanceId = ctx.currentInstance.id;
- const userId = ctx.options.accessToken.userId;
- try {
- return (instanceId == userId);
- } catch (error) {
- throw new UserError(error);
- }
- }
+// async function checkModifyPermission(ctx) {
+// const instanceId = ctx.currentInstance.id;
+// const userId = ctx.options.accessToken.userId;
+// try {
+// if (instanceId === userId) return true;
+// return
+// } catch (error) {
+// throw new UserError(error);
+// }
+// }
};
diff --git a/modules/worker/front/basic-data/index.html b/modules/worker/front/basic-data/index.html
index a8b404da6..f764b3137 100644
--- a/modules/worker/front/basic-data/index.html
+++ b/modules/worker/front/basic-data/index.html
@@ -79,7 +79,6 @@
vn-one
label="Recovery phone"
ng-model="$ctrl.worker.user.recoveryPhone"
- disabled="$root.user.id !== $ctrl.worker.id"
>