Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Giving a user clear information on each unauthorized attempt where its not given in the frontend #174

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified .eslintrc.js
100755 → 100644
Empty file.
Empty file modified .prettierrc
100755 → 100644
Empty file.
12 changes: 6 additions & 6 deletions src/app/view/all-users/all-users.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ export class AllUsersComponent {
error: (err) => {
if (err.error.statusCode === 403) {
this.toastrService.error(
'Error:' + err.error.message,
'Unauthorized',
"You don't have the permissions to access the users page.",
'Access Denied',
);
} else {
this.toastrService.error('Error:' + err.error.message, 'Fail');
Expand All @@ -224,8 +224,8 @@ export class AllUsersComponent {
error: (err) => {
if (err.error.statusCode === 403) {
this.toastrService.error(
'Error:' + err.error.message,
'Unauthorized',
"You don't have the permissions to access the users page.",
'Access Denied',
);
} else {
this.toastrService.error('Error:' + err.error.message, 'Fail');
Expand All @@ -249,8 +249,8 @@ export class AllUsersComponent {
error: (err) => {
if (err.error.statusCode === 403) {
this.toastrService.error(
'Error:' + err.error.message,
'Unauthorized',
"You don't have the permissions to access the users page.",
'Access Denied',
);
} else {
this.toastrService.error('Error:' + err.error.message, 'Fail');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,10 @@ export class CertificateDetailsComponent {
this.loading = false;

if (err.error.statusCode === 403) {
this.toastrService.error('You are Unauthorized');
this.toastrService.error(
"You don't have the permissions to access the certificate page.",
'Access Denied',
);
} else {
this.toastrService.error('Error', err.error.message);
}
Expand Down
10 changes: 8 additions & 2 deletions src/app/view/device/add-bulk-device/add-bulk-device.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,10 @@ export class AddBulkDeviceComponent implements OnInit {
//Error callback
console.error('error caught in component', err);
if (err.error.statusCode === 403) {
this.toastrService.error('You are Unauthorized');
this.toastrService.error(
"You don't have the permissions to add devices.",
'Access Denied',
);
} else {
this.toastrService.error('error!', err.error.message);
}
Expand All @@ -173,7 +176,10 @@ export class AddBulkDeviceComponent implements OnInit {
//Error callback
console.error('error caught in component', err);
if (err.error.statusCode === 403) {
this.toastrService.error('You are Unauthorized');
this.toastrService.error(
"You don't have the permissions to add devices.",
'Access Denied',
);
} else {
this.toastrService.error('error!', err.error.message);
}
Expand Down
5 changes: 4 additions & 1 deletion src/app/view/device/add-devices/add-devices.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,10 @@ export class AddDevicesComponent {
//Error callback
console.error('error caught in component', err.error.message);
if (err.error.statusCode === 403) {
this.toastrService.error('You are Unauthorized');
this.toastrService.error(
"You don't have the permissions to add a device.",
'Access Denied',
);
} else {
this.toastrService.error(
'some error occurred due to ' + err.error.message,
Expand Down
5 changes: 4 additions & 1 deletion src/app/view/device/alldevices/alldevices.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,10 @@ export class AlldevicesComponent {
error: (err) => {
console.log(err);
if (err.error.statusCode === 403) {
this.toastrService.error('You are Unauthorized');
this.toastrService.error(
"You don't have the permissions to access the devices.",
'Access Denied',
);
} else {
this.toastrService.error('Error', err.error.message);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
OrganizationService,
} from '../../../auth/services';
import { Router, ActivatedRoute } from '@angular/router';

import { ToastrService } from 'ngx-toastr';
import { MatSort } from '@angular/material/sort';
import { MatPaginator } from '@angular/material/paginator';
Expand Down Expand Up @@ -114,8 +115,11 @@ export class UserInvitationComponent {
this.getorginviteuserlist();
}
},
error: (err) => {
this.toastrService.error('Fail', err.error.message);
error: () => {
this.toastrService.error(
"You don't have the permissions to invite a user to this organization",
'Access Denied',
);
},
});
}
Expand Down
Binary file removed src/favicon.ico
Binary file not shown.
Loading