Ability to restrict a user's ability to change passwords (#1018)
* Implemented a new role "Change Password". This role allows you to change your own password. By default, all users will have it. A user can have it removed arbitrarliy. Removed components that are no longer going to be used. * Cleaned up some code
This commit is contained in:
parent
9d20343f4e
commit
6ee8320c2b
16 changed files with 48 additions and 174 deletions
|
|
@ -194,7 +194,7 @@
|
|||
<app-series-bookmarks></app-series-bookmarks>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="tab.fragment === 'password'">
|
||||
<ng-container *ngIf="isAdmin">
|
||||
<ng-container *ngIf="(isAdmin || hasChangePasswordRole); else noPermission">
|
||||
<p>Change your Password</p>
|
||||
<div class="alert alert-danger" role="alert" *ngIf="resetPasswordErrors.length > 0">
|
||||
<div *ngFor="let error of resetPasswordErrors">{{error}}</div>
|
||||
|
|
@ -227,6 +227,9 @@
|
|||
</div>
|
||||
</form>
|
||||
</ng-container>
|
||||
<ng-template #noPermission>
|
||||
<p>You do not have permission to change your password. Reach out to the admin of the server.</p>
|
||||
</ng-template>
|
||||
</ng-container>
|
||||
<ng-container *ngIf="tab.fragment === 'clients'">
|
||||
<p>All 3rd Party clients will either use the API key or the Connection Url below. These are like passwords, keep it private.</p>
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import { AccountService } from 'src/app/_services/account.service';
|
|||
import { NavService } from 'src/app/_services/nav.service';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { SettingsService } from 'src/app/admin/settings.service';
|
||||
import { Member } from 'src/app/_models/member';
|
||||
|
||||
@Component({
|
||||
selector: 'app-user-preferences',
|
||||
|
|
@ -28,6 +29,7 @@ export class UserPreferencesComponent implements OnInit, OnDestroy {
|
|||
passwordChangeForm: FormGroup = new FormGroup({});
|
||||
user: User | undefined = undefined;
|
||||
isAdmin: boolean = false;
|
||||
hasChangePasswordRole: boolean = false;
|
||||
|
||||
passwordsMatch = false;
|
||||
resetPasswordErrors: string[] = [];
|
||||
|
|
@ -85,6 +87,7 @@ export class UserPreferencesComponent implements OnInit, OnDestroy {
|
|||
if (user) {
|
||||
this.user = user;
|
||||
this.isAdmin = this.accountService.hasAdminRole(user);
|
||||
this.hasChangePasswordRole = this.accountService.hasChangePasswordRole(user);
|
||||
|
||||
if (this.fontFamilies.indexOf(this.user.preferences.bookReaderFontFamily) < 0) {
|
||||
this.user.preferences.bookReaderFontFamily = 'default';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue