1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-20 14:54:15 +01:00

do not delete the user if superadmin + fix text alert

This commit is contained in:
Sylvain 2019-06-17 11:12:05 +02:00
parent 92381ce4bc
commit 2d92df3ebb
2 changed files with 13 additions and 10 deletions

View File

@ -119,6 +119,9 @@ Application.Controllers.controller('EditProfileController', ['$scope', '$rootSco
}
};
// This boolean value will tell if the current user is the super-admin
$scope.isSuperAdmin = memberPromise.id === Fablab.superadminId;
/**
* Return the group object, identified by the ID set in $scope.userGroup
*/
@ -139,10 +142,10 @@ Application.Controllers.controller('EditProfileController', ['$scope', '$rootSco
$rootScope.currentUser = user;
Auth._currentUser.group_id = user.group_id;
$scope.group.change = false;
return growl.success(_t('your_group_has_been_successfully_changed'));
return growl.success(_t('edit_profile.your_group_has_been_successfully_changed'));
}
, function (err) {
growl.error(_t('an_unexpected_error_prevented_your_group_from_being_changed'));
growl.error(_t('edit_profile.an_unexpected_error_prevented_your_group_from_being_changed'));
return console.error(err);
});
@ -197,11 +200,11 @@ Application.Controllers.controller('EditProfileController', ['$scope', '$rootSco
return {
title: _t('confirmation_required'),
msg: $sce.trustAsHtml(
_t('confirm_delete_your_account') + '<br/>' +
'<strong>' + _t('all_data_will_be_lost') + '</strong><br/><br/>' +
_t('invoicing_data_kept') + '<br/>' +
_t('statistic_data_anonymized') + '<br/>' +
_t('no_further_access_to_projects')
_t('edit_profile.confirm_delete_your_account') + '<br/>' +
'<strong>' + _t('edit_profile.all_data_will_be_lost') + '</strong><br/><br/>' +
_t('edit_profile.invoicing_data_kept') + '<br/>' +
_t('edit_profile.statistic_data_anonymized') + '<br/>' +
_t('edit_profile.no_further_access_to_projects')
)
};
}
@ -211,12 +214,12 @@ Application.Controllers.controller('EditProfileController', ['$scope', '$rootSco
Member.remove({ id: user.id }, () =>
Auth.logout().then(function () {
$state.go('app.public.home');
return growl.success(_t('your_user_account_has_been_successfully_deleted_goodbye'));
return growl.success(_t('edit_profile.your_user_account_has_been_successfully_deleted_goodbye'));
})
, function (error) {
console.log(error);
return growl.error(_t('an_error_occured_preventing_your_account_from_being_deleted'));
return growl.error(_t('edit_profile.an_error_occured_preventing_your_account_from_being_deleted'));
})
);

View File

@ -84,7 +84,7 @@
<div ng-hide="cookiesStatus" translate>{{ 'edit_profile.cookies_unset' }}</div>
<button ng-click="resetCookies()" ng-show="cookiesStatus" class="btn text-black btn-warning-full btn-sm m-t-xs" translate>{{ 'edit_profile.reset_cookies' }}</button>
</div>
<div class="widget-content no-bg text-center auto wrapper">
<div class="widget-content no-bg text-center auto wrapper" ng-hide="isSuperAdmin">
<button class="btn text-white btn-danger btn-sm" ng-click="deleteUser(user)"><i class="fa fa-warning m-r-xs"></i> {{ 'edit_profile.delete_my_account' | translate }}</button>
</div>
</div>