mirror of
https://github.com/Tzahi12345/YoutubeDL-Material.git
synced 2026-03-19 19:21:02 +03:00
Added roles and permissions system, as well as the ability to modify users and their roles
Downloads manager now uses device fingerprint as identifier rather than a randomly generated sessionID
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
<h4 mat-dialog-title i18n="Register user dialog title">Register a user</h4>
|
||||
|
||||
<mat-dialog-content>
|
||||
<div>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="User name" [(ngModel)]="usernameInput">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div>
|
||||
<mat-form-field>
|
||||
<input matInput placeholder="Password" [(ngModel)]="passwordInput" type="password">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</mat-dialog-content>
|
||||
|
||||
<mat-dialog-actions>
|
||||
<button color="accent" (click)="createUser()" mat-raised-button><ng-container i18n="Register user button">Register</ng-container></button>
|
||||
<button mat-dialog-close mat-button><ng-container i18n="Close button">Close</ng-container></button>
|
||||
</mat-dialog-actions>
|
||||
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AddUserDialogComponent } from './add-user-dialog.component';
|
||||
|
||||
describe('AddUserDialogComponent', () => {
|
||||
let component: AddUserDialogComponent;
|
||||
let fixture: ComponentFixture<AddUserDialogComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ AddUserDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(AddUserDialogComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
32
src/app/dialogs/add-user-dialog/add-user-dialog.component.ts
Normal file
32
src/app/dialogs/add-user-dialog/add-user-dialog.component.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { PostsService } from 'app/posts.services';
|
||||
import { MatDialogRef } from '@angular/material/dialog';
|
||||
|
||||
@Component({
|
||||
selector: 'app-add-user-dialog',
|
||||
templateUrl: './add-user-dialog.component.html',
|
||||
styleUrls: ['./add-user-dialog.component.scss']
|
||||
})
|
||||
export class AddUserDialogComponent implements OnInit {
|
||||
|
||||
usernameInput = '';
|
||||
passwordInput = '';
|
||||
|
||||
constructor(private postsService: PostsService, public dialogRef: MatDialogRef<AddUserDialogComponent>) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
createUser() {
|
||||
this.postsService.register(this.usernameInput, this.passwordInput).subscribe(res => {
|
||||
if (res['user']) {
|
||||
this.dialogRef.close(res['user']);
|
||||
} else {
|
||||
this.dialogRef.close({error: 'Unknown error'});
|
||||
}
|
||||
}, err => {
|
||||
this.dialogRef.close({error: err});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,7 +7,7 @@
|
||||
<div style="position: relative">
|
||||
<div>
|
||||
<mat-form-field color="accent">
|
||||
<input type="password" (keyup.enter)="create()" matInput [(ngModel)]="input" placeholder="Password" placeholder-i18n="Password">
|
||||
<input type="password" (keyup.enter)="create()" matInput [(ngModel)]="input" placeholder="Password" i18n-placeholder="Password">
|
||||
</mat-form-field>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user