update
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
<nav mat-tab-nav-bar>
|
||||
<a mat-tab-link routerLink="info" routerLinkActive="active">{{'info' | i18n}}</a>
|
||||
<a mat-tab-link routerLink="profile" routerLinkActive="active">{{'profile' | i18n}}</a>
|
||||
<a mat-tab-link routerLink="voucher" routerLinkActive="active">{{'vouchers' | i18n}}</a>
|
||||
<a mat-tab-link routerLink="security" routerLinkActive="active">{{'security' | i18n}}</a>
|
||||
</nav>
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<h3>{{'permissions' | i18n}}</h3>
|
||||
<app-permissions [permissions]="permissions"></app-permissions>
|
||||
<h3>{{'quotas' | i18n}}</h3>
|
||||
<app-quotas [quotas]="quotas"></app-quotas>
|
||||
<app-quotas [quotas]="quotas"></app-quotas>
|
||||
<h3>{{'profile' | i18n}}</h3>
|
||||
<app-profilefields [profileFields]="profileFields"></app-profilefields>
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { PermissionService } from './../../../services/permission.service';
|
||||
import { QuotaService } from './../../../services/quota.service';
|
||||
import { ProfileService } from './../../../services/profile.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-account-info',
|
||||
@@ -11,8 +12,9 @@ export class InfoComponent implements OnInit {
|
||||
|
||||
permissions = [];
|
||||
quotas = [];
|
||||
profileFields = [];
|
||||
|
||||
constructor(private permissionService: PermissionService, private quotaService: QuotaService) { }
|
||||
constructor(private permissionService: PermissionService, private quotaService: QuotaService, private profileService : ProfileService) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
this.permissionService.permissions().subscribe((data: any) => {
|
||||
@@ -22,6 +24,10 @@ export class InfoComponent implements OnInit {
|
||||
this.quotaService.quotas().subscribe((data: any) => {
|
||||
this.quotas = data;
|
||||
})
|
||||
|
||||
this.profileService.getAll().subscribe((data: any) => {
|
||||
this.profileFields = data;
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<app-profilefields [profileFields]="profileFields" [edit]="true"></app-profilefields>
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
td.mat-cell {
|
||||
padding: 12px;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import {ComponentFixture, TestBed} from '@angular/core/testing';
|
||||
|
||||
import {ProfileComponent} from './profile.component';
|
||||
|
||||
describe('ProfileComponent', () => {
|
||||
let component: ProfileComponent;
|
||||
let fixture: ComponentFixture<ProfileComponent>;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ProfileComponent]
|
||||
})
|
||||
.compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ProfileComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,24 @@
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {ProfileService} from '../../../services/profile.service';
|
||||
import {I18nService} from '../../../services/i18n.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-account-profile',
|
||||
templateUrl: './profile.component.html',
|
||||
styleUrls: ['./profile.component.scss']
|
||||
})
|
||||
export class ProfileComponent implements OnInit {
|
||||
|
||||
profileFields = [];
|
||||
types = ["TEXT", "NUMBER", "DATE", "URL", "EMAIL", "BOOL"];
|
||||
visibilities = ["PRIVATE", "PROTECTED", "PUBLIC"];
|
||||
|
||||
constructor(private profileService: ProfileService, private i18n: I18nService) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.profileService.getAll().subscribe((data: any) => {
|
||||
this.profileFields = data;
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,5 +12,5 @@
|
||||
</div>
|
||||
<div mat-dialog-actions>
|
||||
<button mat-button [mat-dialog-close]="false">{{'cancel' | i18n}}</button>
|
||||
<button [disabled]="code.invalid" mat-raised-button [mat-dialog-close]="code.value" cdkFocusInitial color="accent">{{'security.2fa.totp.enable' | i18n}}</button>
|
||||
<button [disabled]="code.invalid" mat-raised-button [mat-dialog-close]="code.value" color="accent">{{'security.2fa.totp.enable' | i18n}}</button>
|
||||
</div>
|
||||
@@ -23,7 +23,7 @@
|
||||
{{'home.club.charter' | i18n}}
|
||||
</mat-panel-title>
|
||||
</mat-expansion-panel-header>
|
||||
<app-html [template]="'club/charter'"></app-html>
|
||||
<app-html class="text-justify" [template]="'club/charter'"></app-html>
|
||||
</mat-expansion-panel>
|
||||
|
||||
</mat-accordion>
|
||||
@@ -41,4 +41,18 @@ export class PrivacyPolicyComponent implements OnInit {
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'app-terms-of-service',
|
||||
templateUrl: './home.terms-of-service.html'
|
||||
})
|
||||
export class TermsOfServiceComponent implements OnInit {
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<app-html [template]="'terms-of-service'"></app-html>
|
||||
@@ -1,15 +1,15 @@
|
||||
import { Component, OnInit, Inject } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { Router } from '@angular/router';
|
||||
import {Component, OnInit, Inject, ViewChild, ElementRef} from '@angular/core';
|
||||
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
|
||||
import {MatDialog, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material/dialog';
|
||||
import {Router} from '@angular/router';
|
||||
|
||||
|
||||
import { UserService } from './../../services/user.service';
|
||||
import { ItemService } from './../../services/item.service';
|
||||
import { I18nService } from './../../services/i18n.service';
|
||||
import { MatchingValidator } from './../../utils/matching.validator';
|
||||
import {UserService} from './../../services/user.service';
|
||||
import {ItemService} from './../../services/item.service';
|
||||
import {I18nService} from './../../services/i18n.service';
|
||||
import {MatchingValidator} from './../../utils/matching.validator';
|
||||
|
||||
import { uniqueNamesGenerator, Config, adjectives, colors, animals } from 'unique-names-generator';
|
||||
import {uniqueNamesGenerator, Config, adjectives, colors, animals} from 'unique-names-generator';
|
||||
|
||||
var openpgp = require('openpgp');
|
||||
|
||||
@@ -71,10 +71,10 @@ export class RegisterComponent implements OnInit {
|
||||
|
||||
register() {
|
||||
this.missingToken = false;
|
||||
if (this.form.valid && !this.working) {
|
||||
if(this.form.valid && !this.working) {
|
||||
this.working = true;
|
||||
let pgpOption = {
|
||||
userIds: [{ name: this.model.username, email: this.model.username + "@we.bstly.de" }],
|
||||
userIds: [{name: this.model.username, email: this.model.username + "@we.bstly.de"}],
|
||||
curve: "ed25519",
|
||||
}
|
||||
|
||||
@@ -82,18 +82,21 @@ export class RegisterComponent implements OnInit {
|
||||
openpgp.generateKey(pgpOption).then((key) => {
|
||||
privKey = key.privateKeyArmored;
|
||||
pubKey = key.publicKeyArmored;
|
||||
this.model.publicKey = pubKey;
|
||||
|
||||
this.model.profileFields = [
|
||||
{"name": "publicKey", "type": "BLOB", "visibility": "PROTECTED", "blob": pubKey}
|
||||
]
|
||||
|
||||
if(this.model.email) {
|
||||
this.model.profileFields.push({"name": "email", "type": "EMAIL", "visibility": "PRITAVE", "value": this.model.email})
|
||||
}
|
||||
if(this.model.primaryEmail) {
|
||||
this.model.profileFields.push({"name": "primaryEmail", "type": "BOOL", "visibility": "PRITAVE", "value": this.model.primaryEmail})
|
||||
}
|
||||
|
||||
this.userService.register(this.model).subscribe((result: any) => {
|
||||
result.privateKey = privKey;
|
||||
|
||||
var element = document.createElement('a');
|
||||
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(privKey));
|
||||
element.setAttribute('download', result.username + ".private.key");
|
||||
element.style.display = 'none';
|
||||
document.body.appendChild(element);
|
||||
element.click();
|
||||
document.body.removeChild(element);
|
||||
|
||||
const dialogRef = this.dialog.open(RegisterDialog, {
|
||||
closeOnNavigation: false,
|
||||
disableClose: true,
|
||||
@@ -101,7 +104,7 @@ export class RegisterComponent implements OnInit {
|
||||
});
|
||||
|
||||
dialogRef.afterClosed().subscribe(result => {
|
||||
if (result) {
|
||||
if(result) {
|
||||
this.success = true;
|
||||
}
|
||||
});
|
||||
@@ -109,20 +112,21 @@ export class RegisterComponent implements OnInit {
|
||||
this.working = false;
|
||||
}, (error) => {
|
||||
this.working = false;
|
||||
if (error.status == 401) {
|
||||
if(error.status == 401) {
|
||||
this.missingToken = true;
|
||||
} else if (error.status == 409) {
|
||||
} else if(error.status == 409) {
|
||||
let errors = {};
|
||||
for (let code of error.error) {
|
||||
for(let code of error.error) {
|
||||
errors[code.field] = errors[code.field] || {};
|
||||
errors[code.field][code.code] = true;
|
||||
}
|
||||
|
||||
for (let code in errors) {
|
||||
for(let code in errors) {
|
||||
this.form.get(code).setErrors(errors[code]);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -136,8 +140,22 @@ export class RegisterComponent implements OnInit {
|
||||
})
|
||||
export class RegisterDialog {
|
||||
|
||||
public downloaded: boolean = false;
|
||||
|
||||
@ViewChild("downloadKey", {read: ElementRef}) downloadKey: ElementRef;
|
||||
|
||||
constructor(private router: Router,
|
||||
public dialogRef: MatDialogRef<RegisterDialog>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) {
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.downloadKey.nativeElement.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(this.data.privateKey));
|
||||
this.downloadKey.nativeElement.setAttribute('download', this.data.username + ".private.key");
|
||||
}
|
||||
|
||||
setDownloaded() {
|
||||
this.downloaded = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<h1 mat-dialog-title>{{data.username}}</h1>
|
||||
<div mat-dialog-content>
|
||||
<mat-dialog-content>
|
||||
<h3>{{'permissions' | i18n}}</h3>
|
||||
<app-permissions [permissions]="data.permissions"></app-permissions>
|
||||
<h3>{{'quotas' | i18n}}</h3>
|
||||
@@ -10,11 +10,19 @@
|
||||
<mat-label>{{'pgp.privateKey' | i18n}}</mat-label>
|
||||
<textarea matInput readonly [(ngModel)]="data.privateKey"></textarea>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div mat-dialog-actions>
|
||||
<mat-slide-toggle [(ngModel)]="data.confirmClose">
|
||||
</mat-dialog-content>
|
||||
<mat-dialog-actions>
|
||||
<a mat-raised-button color="primary" #downloadKey (click)="setDownloaded()">{{'pgp.privateKey.downloadKey' |
|
||||
i18n}}</a>
|
||||
<button mat-icon-button [matTooltip]="'pgp.privateKey.help' | i18n" matTooltipPosition="after">
|
||||
<mat-icon>help</mat-icon>
|
||||
</button>
|
||||
</mat-dialog-actions>
|
||||
<br />
|
||||
<mat-dialog-actions>
|
||||
<mat-slide-toggle [(ngModel)]="data.confirmClose" [disabled]="!downloaded">
|
||||
{{'pgp.privateKey.confirmStore' | i18n}}
|
||||
</mat-slide-toggle>
|
||||
|
||||
<button mat-button [disabled]="!data.confirmClose" [mat-dialog-close]="true">{{'ok' | i18n}}</button>
|
||||
</div>
|
||||
</mat-dialog-actions>
|
||||
Reference in New Issue
Block a user