This commit is contained in:
Lurkars
2021-01-12 19:29:00 +01:00
parent b7b4e2d032
commit 997a512e00
96 changed files with 2711 additions and 304 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
<h2>{{'greet' | i18n:auth.name}} <mat-icon aria-hidden="false" aria-label="Smile">sentiment_satisfied_alt</mat-icon>
<h2>{{'greet' | i18n:auth.name}} <mat-icon>sentiment_satisfied_alt</mat-icon>
</h2>
<nav mat-tab-nav-bar>
@@ -0,0 +1,16 @@
<h1 mat-dialog-title>{{'security.2fa.totp.enable' | i18n}}</h1>
<div mat-dialog-content>
{{'security.2fa.totp.hint' | i18n}}
<qrcode *ngIf="data.qrData" [qrdata]="data.qrData" [width]="400" [errorCorrectionLevel]="'M'" title="{{data.qrData}}"></qrcode>
{{'security.2fa.totp.activate' | i18n}}
<mat-form-field>
<input matInput placeholder="{{'security.2fa.totp.code' | i18n}}" [formControl]="code" required>
</mat-form-field>
</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>
</div>
@@ -1,4 +1,4 @@
<form [formGroup]="form" (ngSubmit)="changePassword()" #formDirective="ngForm">
<form [formGroup]="passwordForm" (ngSubmit)="changePassword()" #passwordFormDirective="ngForm">
<mat-card>
<mat-card-content>
<h2>{{'password.change' | i18n}}</h2>
@@ -6,22 +6,22 @@
{{'password.changed' | i18n}}
</mat-hint>
<mat-form-field>
<input matInput type="password" placeholder="{{'password.current' | i18n}}" formControlName="oldPassword"
[(ngModel)]="model.old">
<mat-error *ngFor="let error of form.get('oldPassword').errors | keyvalue">
<input matInput type="password" placeholder="{{'password.current' | i18n}}"
formControlName="oldPassword" [(ngModel)]="model.old">
<mat-error *ngFor="let error of passwordForm.get('oldPassword').errors | keyvalue">
{{error.key}}
</mat-error>
</mat-form-field>
<mat-form-field>
<input matInput type="password" placeholder="{{'password' | i18n}}" formControlName="password"
[(ngModel)]="model.password">
<mat-error *ngFor="let error of form.get('password').errors | keyvalue">
<mat-error *ngFor="let error of passwordForm.get('password').errors | keyvalue">
{{error.key}}
</mat-error>
</mat-form-field>
<mat-form-field>
<input matInput type="password" placeholder="{{'password.confirm' | i18n}}" formControlName="password2"
[(ngModel)]="model.password2">
<input matInput type="password" length="6" placeholder="{{'password.confirm' | i18n}}"
formControlName="password2" [(ngModel)]="model.password2">
<mat-error>
{{'password.not-match' | i18n}}
</mat-error>
@@ -29,9 +29,20 @@
</mat-card-content>
<mat-card-actions>
<mat-progress-bar *ngIf="working" mode="indeterminate"></mat-progress-bar>
<button *ngIf="!working" mat-raised-button color="primary" [disabled]="form.invalid">
<button *ngIf="!working" mat-raised-button color="primary" [disabled]="passwordForm.invalid">
{{'password.change' | i18n}}
</button>
</mat-card-actions>
</mat-card>
</form>
</form>
<mat-card>
<mat-card-content>
<h2>{{'security.2fa' | i18n}}</h2>
<p>{{'security.2fa.info' | i18n}}</p>
</mat-card-content>
<mat-card-actions>
<button *ngIf="!totp" (click)="createTotp()" mat-raised-button color="accent">{{'security.2fa.totp.create' | i18n}}</button>
<button *ngIf="totp" (click)="removeTotp()" mat-raised-button color="warn">{{'security.2fa.totp.remove' | i18n}}</button>
</mat-card-actions>
</mat-card>
@@ -1,3 +1,3 @@
mat-form-field {
display: block;
display: inline;
}
@@ -1,6 +1,8 @@
import { Component, OnInit, ViewChild } from '@angular/core';
import { FormBuilder, FormGroup, Validators, NgForm } from '@angular/forms';
import { Component, OnInit, ViewChild, Inject } from '@angular/core';
import { FormBuilder, FormGroup, FormControl, Validators, NgForm } from '@angular/forms';
import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { AuthService } from './../../../services/auth.service';
import { UserService } from './../../../services/user.service';
import { MatchingValidator } from './../../../utils/matching.validator';
@@ -15,28 +17,39 @@ export class SecurityComponent implements OnInit {
model: any = {};
public working: boolean;
public success: boolean;
form: FormGroup;
@ViewChild('formDirective') private formDirective: NgForm;
public totp: boolean = false;
constructor(private formBuilder: FormBuilder, private userService: UserService) { }
passwordForm: FormGroup;
@ViewChild('passwordFormDirective') private passwordFormDirective: NgForm;
constructor(
private formBuilder: FormBuilder,
private userService: UserService,
private authService: AuthService,
public dialog: MatDialog) { }
ngOnInit(): void {
this.form = this.formBuilder.group({
this.passwordForm = this.formBuilder.group({
oldPassword: ['', Validators.required],
password: ['', Validators.required],
password2: ['', Validators.required]
}, {
validator: MatchingValidator('password', 'password2')
});
this.authService.isTotpEnabled().subscribe(response => {
this.totp = true;
}, error => {
this.totp = false;
})
}
changePassword() {
if (this.form.valid && !this.working) {
if (this.passwordForm.valid && !this.working) {
this.working = true;
this.userService.password(this.model).subscribe((result: any) => {
this.formDirective.resetForm();
this.passwordFormDirective.resetForm();
this.success = true;
this.working = false;
}, (error) => {
@@ -49,11 +62,68 @@ export class SecurityComponent implements OnInit {
}
for (let code in errors) {
this.form.get(code).setErrors(errors[code]);
this.passwordForm.get(code).setErrors(errors[code]);
}
}
})
}
}
createTotp() {
this.authService.createTotp().subscribe((result: any) => {
const dialogRef = this.dialog.open(SecurityTotpDialog, {
closeOnNavigation: false,
disableClose: true,
data: result
});
dialogRef.afterClosed().subscribe(result => {
if (result) {
this.authService.enableTotp(result).subscribe((result: any) => {
this.totp = true;
})
} else {
this.authService.removeTotp().subscribe((result: any) => {
this.totp = false;
})
}
});
})
}
enableTotp() {
const dialogRef = this.dialog.open(SecurityTotpDialog, {
closeOnNavigation: false,
disableClose: true,
data: {}
});
}
removeTotp() {
this.authService.removeTotp().subscribe((result: any) => {
this.totp = false;
})
}
}
@Component({
selector: 'app-security-totp-dialog',
templateUrl: 'security-totp.dialog.html',
styleUrls: ['./security.component.scss']
})
export class SecurityTotpDialog {
code: FormControl;
constructor(
public dialogRef: MatDialogRef<SecurityTotpDialog>,
@Inject(MAT_DIALOG_DATA) public data: any
) { }
ngOnInit(): void {
this.code = new FormControl('', [Validators.required, Validators.pattern("[0-9]{6}")]);
}
}
@@ -57,7 +57,6 @@ export class VoucherComponent implements OnInit {
data: this.model
});
}, error => {
console.log(error);
})
}
+16 -19
View File
@@ -1,20 +1,17 @@
<h3>{{'apps' | i18n}}</h3>
<mat-grid-list cols="2">
<mat-grid-tile *ngFor="let app of apps">
<mat-card>
<mat-card-header>
<mat-icon>{{'app.' + app.name + '.icon' | i18n}}</mat-icon>
<mat-card-title>{{'app.' + app.name + '.title' | i18n}}</mat-card-title>
<mat-card-subtitle>{{'app.' + app.name + '.subtitle' | i18n}}</mat-card-subtitle>
</mat-card-header>
<mat-card-content>
<p>
{{ 'app.' + app.name + '.text' | i18n}}
</p>
</mat-card-content>
<mat-card-actions>
<a href="{{app.url}}" target="_blank" mat-raised-button color="primary">{{'app.goto' | i18n}}</a>
</mat-card-actions>
</mat-card>
</mat-grid-tile>
</mat-grid-list>
<mat-card *ngFor="let app of apps">
<mat-card-header>
<mat-icon>{{'apps.' + app.name + '.icon' | i18n}}</mat-icon>
<mat-card-title>{{'apps.' + app.name + '.title' | i18n}}</mat-card-title>
<mat-card-subtitle>{{'apps.' + app.name + '.subtitle' | i18n}}</mat-card-subtitle>
</mat-card-header>
<mat-card-content>
<p>
{{ 'apps.' + app.name + '.text' | i18n}}
</p>
</mat-card-content>
<mat-card-actions>
<a href="{{app.url}}" target="_blank" mat-raised-button color="primary">{{'apps.goto' | i18n}}</a>
</mat-card-actions>
</mat-card>
-4
View File
@@ -1,4 +0,0 @@
mat-card {
width: 100%;
margin: 2em 2em;
}
@@ -0,0 +1,28 @@
<form [formGroup]="form">
<form ngNoForm action="{{apiUrl}}/auth/formlogin/totp" method="POST">
<mat-card>
<mat-card-content>
<h2>{{'security.2fa.totp.external' | i18n}}<mat-icon style="font-size: 1em;">open_in_new
</mat-icon></h2>
<mat-error *ngIf="loginInvalid">
{{'security.2fa.totp.invalid' | i18n}}
</mat-error>
<mat-form-field>
<input id="code" name="code" matInput placeholder="{{'security.2fa.totp.code' | i18n}}"
formControlName="code" required>
<mat-error>
{{'security.2fa.totp.missing' | i18n}}
</mat-error>
</mat-form-field>
<mat-slide-toggle id="keep" name="keep" formControlName="keep">
{{'security.2fa.totp.keepSession' | i18n}}
</mat-slide-toggle>
</mat-card-content>
<mat-card-actions>
<button type="submit" mat-raised-button color="primary"
[disabled]="form.invalid">{{'security.2fa.totp.login' | i18n}}<mat-icon style="font-size: 1em;">open_in_new
</mat-icon></button>
</mat-card-actions>
</mat-card>
</form>
</form>
@@ -0,0 +1,3 @@
mat-form-field {
display: block;
}
@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { FormLoginTotpComponent } from './form-login-totp.component';
describe('FormLoginTotpComponent', () => {
let component: FormLoginTotpComponent;
let fixture: ComponentFixture<FormLoginTotpComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ FormLoginTotpComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(FormLoginTotpComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,28 @@
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { environment } from '../../../environments/environment';
@Component({
selector: 'app-form-login-totp',
templateUrl: './form-login-totp.component.html',
styleUrls: ['./form-login-totp.component.scss']
})
export class FormLoginTotpComponent implements OnInit {
form: FormGroup;
public loginInvalid: boolean;
public apiUrl = environment.apiUrl;
constructor(private formBuilder: FormBuilder) { }
async ngOnInit() {
this.form = this.formBuilder.group({
code: ['', Validators.required],
keep : ['']
});
}
}
@@ -1,9 +1,10 @@
<form [formGroup]="form">
<form ngNoForm action="{{apiUrl}}/auth/login" method="POST">
<form ngNoForm action="{{apiUrl}}/auth/formlogin" method="POST">
<mat-card>
<mat-card-content>
<h2>{{'login.external' | i18n}}<mat-icon style="font-size: 1em;">open_in_new
</mat-icon></h2>
</mat-icon>
</h2>
<mat-error *ngIf="loginInvalid">
{{'login.invalid' | i18n}}
</mat-error>
@@ -21,13 +22,15 @@
{{'password.invalid.hint' | i18n}}
</mat-error>
</mat-form-field>
<mat-slide-toggle id="keep" name="keep" formControlName="keep">
{{'login.keepSession' | i18n}}
</mat-slide-toggle>
</mat-card-content>
<mat-card-actions>
<button type="submit" mat-raised-button color="primary"
[disabled]="form.invalid">{{'login.external' | i18n}}<mat-icon style="font-size: 1em;">open_in_new
</mat-icon></button>
<a routerLink="/password" aria-label="Enter tokens" mat-raised-button
color="warn">{{'password.forgot' | i18n}}</a>
<a routerLink="/password" mat-raised-button color="warn">{{'password.forgot' | i18n}}</a>
</mat-card-actions>
</mat-card>
</form>
@@ -19,7 +19,8 @@ export class FormLoginComponent implements OnInit {
async ngOnInit() {
this.form = this.formBuilder.group({
username: ['', Validators.required],
password: ['', Validators.required]
password: ['', Validators.required],
keep : ['']
});
}
@@ -0,0 +1,29 @@
<mat-accordion>
<mat-expansion-panel expanded>
<mat-expansion-panel-header>
<mat-panel-title>
{{'home.club.membership' | i18n}}
</mat-panel-title>
</mat-expansion-panel-header>
<app-html [template]="'club/membership'"></app-html>
</mat-expansion-panel>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
{{'home.club.about' | i18n}}
</mat-panel-title>
</mat-expansion-panel-header>
<app-html [template]="'club/about'"></app-html>
</mat-expansion-panel>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
{{'home.club.charter' | i18n}}
</mat-panel-title>
</mat-expansion-panel-header>
<app-html [template]="'club/charter'"></app-html>
</mat-expansion-panel>
</mat-accordion>
@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { HomeClubComponent } from './home-club.component';
describe('HomeClubComponent', () => {
let component: HomeClubComponent;
let fixture: ComponentFixture<HomeClubComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ HomeClubComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(HomeClubComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,16 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-home-club',
templateUrl: './home-club.component.html'
})
export class HomeClubComponent implements OnInit {
constructor() {
}
ngOnInit(): void {
}
}
@@ -0,0 +1,28 @@
<mat-accordion>
<mat-expansion-panel expanded>
<mat-expansion-panel-header>
<mat-panel-title>
{{'home.general.what' | i18n}}
</mat-panel-title>
</mat-expansion-panel-header>
<app-html [template]="'general/what'"></app-html>
</mat-expansion-panel>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
{{'home.general.you' | i18n}}
</mat-panel-title>
</mat-expansion-panel-header>
<app-html [template]="'general/you'"></app-html>
</mat-expansion-panel>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
{{'home.general.we' | i18n}}
</mat-panel-title>
</mat-expansion-panel-header>
<app-html [template]="'general/we'"></app-html>
</mat-expansion-panel>
</mat-accordion>
@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { HomeGeneralComponent } from './home-general.component';
describe('HomeGeneralComponent', () => {
let component: HomeGeneralComponent;
let fixture: ComponentFixture<HomeGeneralComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ HomeGeneralComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(HomeGeneralComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,16 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-home-general',
templateUrl: './home-general.component.html'
})
export class HomeGeneralComponent implements OnInit {
constructor() {
}
ngOnInit(): void {
}
}
+12 -25
View File
@@ -1,28 +1,15 @@
<app-html [template]="'about'"></app-html>
<h3>F.A.Q. - Frequently Asked Questions</h3>
<mat-accordion>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
Question 1
</mat-panel-title>
<mat-panel-description>
Answers 1 summaray
</mat-panel-description>
</mat-expansion-panel-header>
<p>TAnswer 1 detail</p>
</mat-expansion-panel>
<nav mat-tab-nav-bar>
<a mat-tab-link routerLink="general" routerLinkActive #rlag="routerLinkActive"
[active]="rlag.isActive">{{'home.general' | i18n}}</a>
<a mat-tab-link routerLink="services" routerLinkActive #rlas="routerLinkActive"
[active]="rlas.isActive">{{'home.services' | i18n}}</a>
<a mat-tab-link routerLink="privacy" routerLinkActive #rlap="routerLinkActive"
[active]="rlap.isActive">{{'home.privacy' | i18n}}</a>
<a mat-tab-link routerLink="club" routerLinkActive #rlac="routerLinkActive"
[active]="rlac.isActive">{{'home.club' | i18n}}</a>
</nav>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
Question 2
</mat-panel-title>
<mat-panel-description>
Answers 2 summaray
</mat-panel-description>
</mat-expansion-panel-header>
<p>TAnswer 2 detail</p>
</mat-expansion-panel>
</mat-accordion>
<p></p>
<router-outlet></router-outlet>
+28 -1
View File
@@ -1,6 +1,5 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-home',
templateUrl: './home.component.html',
@@ -15,3 +14,31 @@ export class HomeComponent implements OnInit {
}
}
@Component({
selector: 'app-imprint',
templateUrl: './home.imprint.html'
})
export class ImprintComponent implements OnInit {
constructor() {
}
ngOnInit(): void {
}
}
@Component({
selector: 'app-privacy-policy',
templateUrl: './home.privacy-policy.html'
})
export class PrivacyPolicyComponent implements OnInit {
constructor() {
}
ngOnInit(): void {
}
}
+1
View File
@@ -0,0 +1 @@
<app-html [template]="'imprint'"></app-html>
@@ -0,0 +1 @@
<app-html [template]="'privacy-policy'"></app-html>
@@ -0,0 +1,57 @@
<h3> {{'home.privacy.design' | i18n}}</h3>
<mat-accordion>
<mat-expansion-panel expanded hideToggle disabled>
<app-html [template]="'privacy/design'"></app-html>
</mat-expansion-panel>
</mat-accordion>
<h3>{{'home.privacy.services' | i18n}}</h3>
<mat-accordion>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
Webserver
</mat-panel-title>
</mat-expansion-panel-header>
<app-html [template]="'privacy/webserver'"></app-html>
</mat-expansion-panel>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
Pretix
</mat-panel-title>
</mat-expansion-panel-header>
<app-html [template]="'privacy/pretix'"></app-html>
</mat-expansion-panel>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
we.bstly
</mat-panel-title>
</mat-expansion-panel-header>
<app-html [template]="'privacy/we-bstly'"></app-html>
</mat-expansion-panel>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
Nextcloud
</mat-panel-title>
</mat-expansion-panel-header>
<app-html [template]="'privacy/nextcloud'"></app-html>
</mat-expansion-panel>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
{{'home.services.email' | i18n}}
</mat-panel-title>
</mat-expansion-panel-header>
<app-html [template]="'privacy/email'"></app-html>
</mat-expansion-panel>
</mat-accordion>
@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { HomePrivacyComponent } from './home-privacy.component';
describe('HomePrivacyComponent', () => {
let component: HomePrivacyComponent;
let fixture: ComponentFixture<HomePrivacyComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ HomePrivacyComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(HomePrivacyComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,16 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-home-privacy',
templateUrl: './home-privacy.component.html'
})
export class HomePrivacyComponent implements OnInit {
constructor() {
}
ngOnInit(): void {
}
}
@@ -0,0 +1,523 @@
<h3>{{'home.services.active' | i18n}}</h3>
<mat-accordion>
<mat-expansion-panel expanded>
<mat-expansion-panel-header>
<mat-panel-title>
we.bstly
</mat-panel-title>
</mat-expansion-panel-header>
<app-html [template]="'services/active/we-bstly'"></app-html>
<span>{{'software' | i18n}}:</span>
<mat-chip-list>
<mat-chip color="accent" selected [matMenuTriggerFor]="webstly">we.bstly</mat-chip>
<mat-menu #webstly="matMenu">
<a href="https://git.bstly.de/_Bastler/we.bstly" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
<a href="https://www.bstly.de" target="_blank" mat-menu-item>
<mat-icon>public</mat-icon> {{'homepage' | i18n}}
</a>
</mat-menu>
</mat-chip-list>
</mat-expansion-panel>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
Nextcloud
</mat-panel-title>
</mat-expansion-panel-header>
<app-html [template]="'services/active/nextcloud'"></app-html>
<span>{{'software' | i18n}}:</span>
<mat-chip-list>
<mat-chip color="accent" selected [matMenuTriggerFor]="nextcloud">Nextcloud</mat-chip>
<mat-menu #nextcloud="matMenu">
<a href="https://github.com/nextcloud/server" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
<a href="https://nextcloud.com" target="_blank" mat-menu-item>
<mat-icon>public</mat-icon> {{'homepage' | i18n}}
</a>
</mat-menu>
<mat-chip color="accent" selected [matMenuTriggerFor]="nextcloud_collabora">Collabora Online</mat-chip>
<mat-menu #nextcloud_collabora="matMenu">
<a href="https://github.com/CollaboraOnline/online" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
<a href="https://www.collaboraoffice.com/code/" target="_blank" mat-menu-item>
<mat-icon>public</mat-icon> {{'homepage' | i18n}}
</a>
</mat-menu>
</mat-chip-list>
<br>
<mat-accordion>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
Apps
</mat-panel-title>
</mat-expansion-panel-header>
<mat-panel-description>
<mat-chip-list>
<mat-chip>Accessibility</mat-chip>
<mat-chip selected [matMenuTriggerFor]="nextcloud_app_announcementcenter">Announcement center
</mat-chip>
<mat-menu #nextcloud_app_announcementcenter="matMenu">
<a href="https://github.com/nextcloud/announcementcenter" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
</mat-menu>
<mat-chip selected [matMenuTriggerFor]="nextcloud_app_apporder">AppOrder</mat-chip>
<mat-menu #nextcloud_app_apporder="matMenu">
<a href="https://github.com/juliushaertl/apporder" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
</mat-menu>
<mat-chip selected [matMenuTriggerFor]="nextcloud_app_calendar">Calendar</mat-chip>
<mat-menu #nextcloud_app_calendar="matMenu">
<a href="https://apps.nextcloud.com/apps/calendar" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
</mat-menu>
<mat-chip selected [matMenuTriggerFor]="nextcloud_app_checksum">Checksum</mat-chip>
<mat-menu #nextcloud_app_checksum="matMenu">
<a href="https://github.com/westberliner/owncloud-checksum/" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
</mat-menu>
<mat-chip selected [matMenuTriggerFor]="nextcloud_app_collabora">Collabora Online</mat-chip>
<mat-menu #nextcloud_app_collabora="matMenu">
<a href="https://github.com/nextcloud/richdocuments" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
</mat-menu>
<mat-chip>Collaborative tags</mat-chip>
<mat-chip>Comments</mat-chip>
<mat-chip selected [matMenuTriggerFor]="nextcloud_app_contacts">Contacts</mat-chip>
<mat-menu #nextcloud_app_contacts="matMenu">
<a href="https://github.com/nextcloud/contacts" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
</mat-menu>
<mat-chip selected [matMenuTriggerFor]="nextcloud_app_contacts">Contacts</mat-chip>
<mat-menu #nextcloud_app_contacts="matMenu">
<a href="https://github.com/nextcloud/contacts" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
</mat-menu>
<mat-chip selected [matMenuTriggerFor]="nextcloud_app_custom_menu">Custom menu</mat-chip>
<mat-menu #nextcloud_app_custom_menu="matMenu">
<a href="https://gitnet.fr/deblan/side_menu" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
</mat-menu>
<mat-chip selected [matMenuTriggerFor]="nextcloud_app_data_request">Data Request</mat-chip>
<mat-menu #nextcloud_app_data_request="matMenu">
<a href="https://github.com/nextcloud/data_request" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
</mat-menu>
<mat-chip selected [matMenuTriggerFor]="nextcloud_app_deck">Deck</mat-chip>
<mat-menu #nextcloud_app_deck="matMenu">
<a href="https://github.com/nextcloud/deck" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
</mat-menu>
<mat-chip>Default encryption module</mat-chip>
<mat-chip>Deleted files</mat-chip>
<mat-chip selected [matMenuTriggerFor]="nextcloud_app_external_sites">External sites</mat-chip>
<mat-menu #nextcloud_app_external_sites="matMenu">
<a href="https://github.com/nextcloud/external" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
</mat-menu>
<mat-chip>Federation</mat-chip>
<mat-chip>File sharing</mat-chip>
<mat-chip>First run wizard</mat-chip>
<mat-chip selected [matMenuTriggerFor]="nextcloud_app_notifications">Notifications</mat-chip>
<mat-menu #nextcloud_app_notifications="matMenu">
<a href="https://github.com/nextcloud/notifications" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
</mat-menu>
<mat-chip selected [matMenuTriggerFor]="nextcloud_app_oidc">OpenID Connect Login</mat-chip>
<mat-menu #nextcloud_app_oidc="matMenu">
<a href="https://github.com/pulsejet/nextcloud-single-openid-connect" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
</mat-menu>
<mat-chip selected [matMenuTriggerFor]="nextcloud_app_password_policy">Password policy
</mat-chip>
<mat-menu #nextcloud_app_password_policy="matMenu">
<a href="https://github.com/nextcloud/password_policy" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
</mat-menu>
<mat-chip selected [matMenuTriggerFor]="nextcloud_app_pdf">PDF viewer</mat-chip>
<mat-menu #nextcloud_app_pdf="matMenu">
<a href="https://github.com/nextcloud/files_pdfviewer" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
</mat-menu>
<mat-chip selected [matMenuTriggerFor]="nextcloud_app_photos">Photos</mat-chip>
<mat-menu #nextcloud_app_photos="matMenu">
<a href="https://github.com/nextcloud/photos" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
</mat-menu>
<mat-chip selected [matMenuTriggerFor]="nextcloud_app_polls">Polls</mat-chip>
<mat-menu #nextcloud_app_polls="matMenu">
<a href="https://github.com/nextcloud/polls" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
</mat-menu>
<mat-chip selected [matMenuTriggerFor]="nextcloud_app_privacy">Privacy</mat-chip>
<mat-menu #nextcloud_app_privacy="matMenu">
<a href="https://github.com/nextcloud/privacy" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
</mat-menu>
<mat-chip selected [matMenuTriggerFor]="nextcloud_app_quota">Quota warning</mat-chip>
<mat-menu #nextcloud_app_quota="matMenu">
<a href="https://github.com/nextcloud/quota_warning" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
</mat-menu>
<mat-chip selected [matMenuTriggerFor]="nextcloud_app_rightclick">Right click</mat-chip>
<mat-menu #nextcloud_app_rightclick="matMenu">
<a href="https://github.com/nextcloud/files_rightclick" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
</mat-menu>
<mat-chip>Share by mail</mat-chip>
<mat-chip>Support</mat-chip>
<mat-chip selected [matMenuTriggerFor]="nextcloud_app_talk">Talk</mat-chip>
<mat-menu #nextcloud_app_talk="matMenu">
<a href="https://github.com/nextcloud/spreed" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
</mat-menu>
<mat-chip selected [matMenuTriggerFor]="nextcloud_app_tasks">Tasks</mat-chip>
<mat-menu #nextcloud_app_tasks="matMenu">
<a href="https://github.com/nextcloud/tasks/" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
</mat-menu>
<mat-chip selected [matMenuTriggerFor]="nextcloud_app_terms">Terms of services</mat-chip>
<mat-menu #nextcloud_app_terms="matMenu">
<a href="https://github.com/nextcloud/terms_of_service/" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
</mat-menu>
<mat-chip selected [matMenuTriggerFor]="nextcloud_app_text">Text</mat-chip>
<mat-menu #nextcloud_app_text="matMenu">
<a href="https://github.com/nextcloud/text" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
</mat-menu>
<mat-chip>Theming</mat-chip>
<mat-chip selected [matMenuTriggerFor]="nextcloud_app_2fagateway">Two-Factor Gateway</mat-chip>
<mat-menu #nextcloud_app_2fagateway="matMenu">
<a href="https://github.com/nextcloud/twofactor_gateway" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
</mat-menu>
<mat-chip selected [matMenuTriggerFor]="nextcloud_app_2fatotp">Two-Factor TOTP Provider
</mat-chip>
<mat-menu #nextcloud_app_2fatotp="matMenu">
<a href="https://github.com/nextcloud/twofactor_totp" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
</mat-menu>
<mat-chip>Versions</mat-chip>
<mat-chip selected [matMenuTriggerFor]="nextcloud_app_videoplayer">Video player</mat-chip>
<mat-menu #nextcloud_app_videoplayer="matMenu">
<a href="https://github.com/nextcloud/files_videoplayer" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
</mat-menu>
</mat-chip-list>
</mat-panel-description>
</mat-expansion-panel>
</mat-accordion>
</mat-expansion-panel>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
{{'home.services.email' | i18n}}
</mat-panel-title>
</mat-expansion-panel-header>
<app-html [template]="'services/active/email'"></app-html>
<span>{{'software' | i18n}}:</span>
<mat-chip-list>
<mat-chip color="accent" selected [matMenuTriggerFor]="dovecot">Dovecot</mat-chip>
<mat-menu #dovecot="matMenu">
<a href="https://github.com/dovecot/core" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
<a href="https://www.dovecot.org" target="_blank" mat-menu-item>
<mat-icon>public</mat-icon> {{'homepage' | i18n}}
</a>
</mat-menu>
<mat-chip color="accent" selected [matMenuTriggerFor]="postfix">Postfix</mat-chip>
<mat-menu #postfix="matMenu">
<a href="http://www.postfix.org/download.html" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
<a href="http://www.postfix.org" target="_blank" mat-menu-item>
<mat-icon>public</mat-icon> {{'homepage' | i18n}}
</a>
</mat-menu>
<mat-chip color="accent" selected [matMenuTriggerFor]="rspamd">Rspamd</mat-chip>
<mat-menu #rspamd="matMenu">
<a href="https://github.com/rspamd/rspamd" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
<a href="https://www.rspamd.com" target="_blank" mat-menu-item>
<mat-icon>public</mat-icon> {{'homepage' | i18n}}
</a>
</mat-menu>
<mat-chip color="accent" selected [matMenuTriggerFor]="rainloop">RainLoop Webmail</mat-chip>
<mat-menu #rainloop="matMenu">
<a href="https://github.com/RainLoop/rainloop-webmail" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
<a href="https://www.rainloop.net" target="_blank" mat-menu-item>
<mat-icon>public</mat-icon> {{'homepage' | i18n}}
</a>
</mat-menu>
</mat-chip-list>
</mat-expansion-panel>
</mat-accordion>
<h3>{{'home.services.planned' | i18n}}</h3>
<mat-accordion>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
Matrix
</mat-panel-title>
</mat-expansion-panel-header>
<app-html [template]="'services/planned/matrix'"></app-html>
<span>{{'software' | i18n}}:</span>
<mat-chip-list>
<mat-chip color="accent" selected [matMenuTriggerFor]="synapse">Synapse</mat-chip>
<mat-menu #synapse="matMenu">
<a href="https://github.com/matrix-org/synapse/" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
<a href="https://matrix.org/docs/projects/server/synapse" target="_blank" mat-menu-item>
<mat-icon>public</mat-icon> {{'homepage' | i18n}}
</a>
</mat-menu>
<mat-chip color="accent" selected [matMenuTriggerFor]="element-web">Element Web</mat-chip>
<mat-menu #element-web="matMenu">
<a href="https://github.com/vector-im/element-web" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
<a href="https://element.io/" target="_blank" mat-menu-item>
<mat-icon>public</mat-icon> {{'homepage' | i18n}}
</a>
</mat-menu>
</mat-chip-list>
</mat-expansion-panel>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
Gitea
</mat-panel-title>
</mat-expansion-panel-header>
<app-html [template]="'services/planned/gitea'"></app-html>
<span>{{'software' | i18n}}:</span>
<mat-chip-list>
<mat-chip color="accent" selected [matMenuTriggerFor]="gitea">Gitea</mat-chip>
<mat-menu #gitea="matMenu">
<a href="https://github.com/go-gitea/gitea" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
<a href="https://gitea.io/" target="_blank" mat-menu-item>
<mat-icon>public</mat-icon> {{'homepage' | i18n}}
</a>
</mat-menu>
</mat-chip-list>
</mat-expansion-panel>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
Jitsi Meet
</mat-panel-title>
</mat-expansion-panel-header>
<app-html [template]="'services/planned/jitsi-meet'"></app-html>
<span>{{'software' | i18n}}:</span>
<mat-chip-list>
<mat-chip color="accent" selected [matMenuTriggerFor]="jitsi">Jitsi Meet</mat-chip>
<mat-menu #jitsi="matMenu">
<a href="https://github.com/jitsi/jitsi-meet" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
<a href="https://jitsi.org/jitsi-meet/" target="_blank" mat-menu-item>
<mat-icon>public</mat-icon> {{'homepage' | i18n}}
</a>
</mat-menu>
</mat-chip-list>
</mat-expansion-panel>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
Wireguard
⚠️
</mat-panel-title>
</mat-expansion-panel-header>
<app-html [template]="'services/planned/wireguard'"></app-html>
<span>{{'software' | i18n}}:</span>
<mat-chip-list>
<mat-chip color="accent" selected [matMenuTriggerFor]="wireguard">Wireguard</mat-chip>
<mat-menu #wireguard="matMenu">
<a href="https://www.wireguard.com/repositories/" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
<a href="https://www.wireguard.com" target="_blank" mat-menu-item>
<mat-icon>public</mat-icon> {{'homepage' | i18n}}
</a>
</mat-menu>
</mat-chip-list>
</mat-expansion-panel>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
PiHole
</mat-panel-title>
</mat-expansion-panel-header>
<app-html [template]="'services/planned/pihole'"></app-html>
<span>{{'software' | i18n}}:</span>
<mat-chip-list>
<mat-chip color="accent" selected [matMenuTriggerFor]="pihole">Pi-Hole</mat-chip>
<mat-menu #pihole="matMenu">
<a href="https://github.com/pi-hole/pi-hole" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
<a href="https://pi-hole.net" target="_blank" mat-menu-item>
<mat-icon>public</mat-icon> {{'homepage' | i18n}}
</a>
</mat-menu>
</mat-chip-list>
</mat-expansion-panel>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
BigBlueButton
⚠️
</mat-panel-title>
</mat-expansion-panel-header>
<app-html [template]="'services/planned/bigbluebutton'"></app-html>
<span>{{'software' | i18n}}:</span>
<mat-chip-list>
<mat-chip color="accent" selected [matMenuTriggerFor]="bigbluebutton">BigBlueButton</mat-chip>
<mat-menu #bigbluebutton="matMenu">
<a href="https://github.com/bigbluebutton/bigbluebutton" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
<a href="https://bigbluebutton.org" target="_blank" mat-menu-item>
<mat-icon>public</mat-icon> {{'homepage' | i18n}}
</a>
</mat-menu>
</mat-chip-list>
</mat-expansion-panel>
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title>
Bitwarden
⚠️
</mat-panel-title>
</mat-expansion-panel-header>
<app-html [template]="'services/planned/bitwarden'"></app-html>
<span>{{'software' | i18n}}:</span>
<mat-chip-list>
<mat-chip color="accent" selected [matMenuTriggerFor]="bitwarden">Bitwarden</mat-chip>
<mat-menu #bitwarden="matMenu">
<a href="https://github.com/bitwarden/server" target="_blank" mat-menu-item>
<mat-icon>code</mat-icon> {{'sourcecode' | i18n}}
</a>
<a href="https://bitwarden.com/" target="_blank" mat-menu-item>
<mat-icon>public</mat-icon> {{'homepage' | i18n}}
</a>
</mat-menu>
</mat-chip-list>
</mat-expansion-panel>
</mat-accordion>
<p>{{'home.services.legend' | i18n}}
<mat-list>
<mat-list-item>{{'home.services.legend.ready' | i18n}}</mat-list-item>
<mat-list-item>{{'home.services.legend.not-ready' | i18n}}</mat-list-item>
<mat-list-item>{{'home.services.legend.not-available' | i18n}}</mat-list-item>
</mat-list>
</p>
@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { HomeServicesComponent } from './home-services.component';
describe('HomeServicesComponent', () => {
let component: HomeServicesComponent;
let fixture: ComponentFixture<HomeServicesComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ HomeServicesComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(HomeServicesComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,16 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-home-services',
templateUrl: './home-services.component.html'
})
export class HomeServicesComponent implements OnInit {
constructor() {
}
ngOnInit(): void {
}
}
@@ -0,0 +1,24 @@
<form [formGroup]="form" (ngSubmit)="loginTotp()">
<mat-card>
<mat-card-content>
<h2>{{'security.2fa.totp' | i18n}}</h2>
<mat-error *ngIf="loginInvalid">
{{'security.2fa.totp.invalid' | i18n}}
</mat-error>
<mat-form-field>
<input id="code" name="code" matInput placeholder="{{'security.2fa.totp.code' | i18n}}" formControlName="code"
required>
<mat-error>
{{'security.2fa.totp.missing' | i18n}}
</mat-error>
</mat-form-field>
<mat-slide-toggle id="keep" name="keep" formControlName="keep">
{{'security.2fa.totp.keepSession' | i18n}}
</mat-slide-toggle>
</mat-card-content>
<mat-card-actions>
<button type="submit" mat-raised-button color="primary"
[disabled]="form.invalid">{{'security.2fa.totp.login' | i18n}}</button>
</mat-card-actions>
</mat-card>
</form>
@@ -0,0 +1,3 @@
mat-form-field {
display: block;
}
@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { LoginTotpComponent } from './login-totp.component';
describe('LoginTotpComponent', () => {
let component: LoginTotpComponent;
let fixture: ComponentFixture<LoginTotpComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ LoginTotpComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(LoginTotpComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,54 @@
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { AuthService } from '../../services/auth.service';
import { Router, ActivatedRoute } from '@angular/router';
import { environment } from '../../../environments/environment';
@Component({
selector: 'app-login',
templateUrl: './login-totp.component.html',
styleUrls: ['./login-totp.component.scss']
})
export class LoginTotpComponent implements OnInit {
form: FormGroup;
public loginInvalid: boolean;
public apiUrl = environment.apiUrl;
targetRoute = '/account/info';
constructor(private formBuilder: FormBuilder, private authService: AuthService, private router: Router, private route: ActivatedRoute) { }
ngOnInit() {
this.form = this.formBuilder.group({
code: ['', Validators.required],
keep: ['']
});
this.route.queryParams.subscribe(params => {
if (params['target']) {
this.targetRoute = params['target'];
}
});
}
async loginTotp() {
this.loginInvalid = false;
if (this.form.valid) {
const totpModel = {
code: this.form.get('code').value,
keep: this.form.get('keep').value
};
this.authService.loginTotp(totpModel).subscribe((response: any) => {
this.router.navigate([this.targetRoute]);
}, error => {
this.loginInvalid = true;
});
}
}
}
+4 -2
View File
@@ -19,12 +19,14 @@
{{'password.invalid.hint' | i18n}}
</mat-error>
</mat-form-field>
<mat-slide-toggle id="keep" name="keep" formControlName="keep">
{{'login.keepSession' | i18n}}
</mat-slide-toggle>
</mat-card-content>
<mat-card-actions>
<button type="submit" mat-raised-button color="primary"
[disabled]="form.invalid">{{'login' | i18n}}</button>
<a routerLink="/password" aria-label="Enter tokens" mat-raised-button
color="warn">{{'password.forgot' | i18n}}</a>
<a routerLink="/password" mat-raised-button color="warn">{{'password.forgot' | i18n}}</a>
</mat-card-actions>
</mat-card>
</form>
+22 -9
View File
@@ -1,7 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { AuthService } from './../../services/auth.service';
import { Router } from '@angular/router';
import { Router, ActivatedRoute } from '@angular/router';
import { environment } from './../../../environments/environment';
@@ -15,27 +15,40 @@ export class LoginComponent implements OnInit {
form: FormGroup;
public loginInvalid: boolean;
public apiUrl = environment.apiUrl;
targetRoute = '/account/info';
loginModel = {};
constructor(private formBuilder: FormBuilder, private authService: AuthService, private router: Router) { }
constructor(private formBuilder: FormBuilder, private authService: AuthService, private router: Router, private route: ActivatedRoute) { }
async ngOnInit() {
this.form = this.formBuilder.group({
username: ['', Validators.required],
password: ['', Validators.required]
password: ['', Validators.required],
keep: ['']
});
this.route.queryParams.subscribe(params => {
if (params['target']) {
this.targetRoute = params['target'];
}
});
}
async login() {
this.loginInvalid = false;
if (this.form.valid) {
const username = this.form.get('username').value;
const password = this.form.get('password').value;
this.authService.login(username, password).subscribe((response: any) => {
this.router.navigate(["/account/info"]);
const loginModel = {
username: this.form.get('username').value,
password: this.form.get('password').value,
keep: this.form.get('keep').value
};
this.authService.login(loginModel).subscribe((response: any) => {
this.router.navigate([this.targetRoute]);
}, error => {
if (error.status == 302) {
console.log(error);
if (error.status == 428) {
this.router.navigate(["/login/totp"], { queryParams: { target: this.targetRoute } });
} else {
this.loginInvalid = true;
}
@@ -0,0 +1,43 @@
<form [formGroup]="form" (ngSubmit)="passwordReset()" *ngIf="!success">
<mat-card>
<mat-card-content>
<h2>{{'password.reset' | i18n}}</h2>
<mat-error *ngIf="tokenInvalid">
{{'password.reset.tokenInvalid' | i18n}}
</mat-error>
<mat-form-field>
<input matInput type="password" placeholder="{{'password' | i18n}}" formControlName="password"
[(ngModel)]="model.password">
<mat-error *ngFor="let error of form.get('password').errors | keyvalue">
{{error.key}}
</mat-error>
</mat-form-field>
<mat-form-field>
<input matInput type="password" length="6" placeholder="{{'password.confirm' | i18n}}"
formControlName="password2" [(ngModel)]="model.password2">
<mat-error>
{{'password.not-match' | i18n}}
</mat-error>
</mat-form-field>
</mat-card-content>
<mat-card-actions>
<button *ngIf="!working" mat-raised-button color="primary" [disabled]="form.invalid">
{{'password.reset' | i18n}}
</button>
<mat-progress-bar *ngIf="working" mode="indeterminate"></mat-progress-bar>
</mat-card-actions>
</mat-card>
</form>
<mat-card *ngIf="success">
<mat-card-content>
<h2>{{'password.reset.success.title' | i18n}}</h2>
<p>{{'password.reset.success.text' | i18n}}</p>
</mat-card-content>
<mat-card-actions>
<a routerLink="/login" mat-raised-button color="primary">
{{'password.reset.login' | i18n}}
</a>
</mat-card-actions>
</mat-card>
@@ -0,0 +1,3 @@
mat-form-field {
display: block;
}
@@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { PasswordResetComponent } from './password-reset.component';
describe('PasswordResetComponent', () => {
let component: PasswordResetComponent;
let fixture: ComponentFixture<PasswordResetComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ PasswordResetComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(PasswordResetComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
@@ -0,0 +1,65 @@
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { AuthService } from '../../services/auth.service';
import { MatchingValidator } from '../../utils/matching.validator';
import { ActivatedRoute, Router } from '@angular/router';
@Component({
selector: 'app-password-reset',
templateUrl: './password-reset.component.html',
styleUrls: ['./password-reset.component.scss']
})
export class PasswordResetComponent implements OnInit {
form: FormGroup;
model: any = {};
public working: boolean;
public success: boolean;
public tokenInvalid: boolean = false;
constructor(
private formBuilder: FormBuilder,
private authService: AuthService,
private router: Router,
private route: ActivatedRoute) { }
ngOnInit(): void {
this.form = this.formBuilder.group({
password: ['', Validators.required],
password2: ['', Validators.required]
}, {
validator: MatchingValidator('password', 'password2')
});
this.route.queryParams.subscribe(params => {
if (params.token) {
this.model.token = params.token;
}
});
}
passwordReset() {
this.working = true;
this.authService.passwordReset(this.model).subscribe(response => {
this.success = true;
}, (error) => {
this.working = false;
if (error.status == 409) {
let errors = {};
for (let code of error.error) {
errors[code.field] = errors[code.field] || {};
errors[code.field][code.code] = true;
}
for (let code in errors) {
this.form.get(code).setErrors(errors[code]);
}
} else {
this.tokenInvalid = true;
}
})
}
}
@@ -1,4 +1,4 @@
<form [formGroup]="form" (ngSubmit)="passwordReset()">
<form [formGroup]="form" (ngSubmit)="passwordRequest()">
<mat-card>
<mat-card-content>
<h2>{{'password.request' | i18n}}</h2>
@@ -10,15 +10,17 @@
</mat-form-field>
<mat-form-field>
<mat-label>{{'pgp-key.private' | i18n}}</mat-label>
<mat-label>{{'pgp.privateKey' | i18n}}</mat-label>
<textarea matInput formControlName="privateKey" placeholder="Private Key"
[(ngModel)]="model.privateKey"></textarea>
</mat-form-field>
</mat-card-content>
<mat-card-actions>
<button *ngIf="!working" mat-raised-button color="primary" [disabled]="form.invalid">
{{'password.reset' | i18n}}
{{'password.request' | i18n}}
</button>
<mat-progress-bar *ngIf="working" mode="indeterminate"></mat-progress-bar>
</mat-card-actions>
</mat-card>
</form>
+21 -19
View File
@@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { AuthService } from './../../services/auth.service';
import { MatchingValidator } from './../../utils/matching.validator';
import { Router } from '@angular/router';
var openpgp = require('openpgp');
@Component({
@@ -16,37 +16,39 @@ export class PasswordComponent implements OnInit {
public working: boolean;
form: FormGroup;
constructor(private formBuilder: FormBuilder, private authService: AuthService) { }
constructor(private formBuilder: FormBuilder, private authService: AuthService, private router: Router) { }
ngOnInit(): void {
this.form = this.formBuilder.group({
username: ['', Validators.required],
privateKey: ['', Validators.required]
privateKey: ['']
});
}
async passwordReset() {
async passwordRequest() {
this.working = true;
const { keys: [privateKey] } = await openpgp.key.readArmored(this.model.privateKey);
console.log(privateKey.isPrivate());
const model = {
username: this.model.username
}
/*
const message = await openpgp.message.readArmored(encrypted);
const decrypted = await openpgp.decrypt({
message: message,
privateKeys: [privateKey]
});
console.log(decrypted);
// this.authService.passwordReset(model).subscribe(async response => { })
*/
this.authService.passwordRequest(this.model.username).subscribe(async response => {
if (privateKey) {
const message = await openpgp.message.readArmored(response);
const decrypted = await openpgp.decrypt({
message: message,
privateKeys: [privateKey]
});
this.working = false;
this.router.navigate(['/password-reset'], { queryParams: { token: decrypted.data.trim() } });
} else {
this.working = false;
}
})
}
}
+15 -3
View File
@@ -1,9 +1,9 @@
<form [formGroup]="form" (ngSubmit)="register()">
<form [formGroup]="form" (ngSubmit)="register()" *ngIf="!success">
<mat-card>
<mat-card-content>
<h2>{{'register' | i18n}}</h2>
<mat-error *ngIf="missingToken">
<a routerLink="/tokens" aria-label="Enter tokens">{{'register.token.missing' | i18n}}</a>
<a routerLink="/tokens">{{'register.token.missing' | i18n}}</a>
</mat-error>
<mat-form-field>
<input matInput placeholder="{{'username' | i18n}}" formControlName="username"
@@ -59,4 +59,16 @@
<mat-progress-bar *ngIf="working" mode="indeterminate"></mat-progress-bar>
</mat-card-actions>
</mat-card>
</form>
</form>
<mat-card *ngIf="success">
<mat-card-content>
<h2>{{'register.success.title' | i18n}}</h2>
<p>{{'register.success.text' | i18n}}</p>
</mat-card-content>
<mat-card-actions>
<a routerLink="/login" mat-raised-button color="primary">
{{'register.login' | i18n}}
</a>
</mat-card-actions>
</mat-card>
+21 -10
View File
@@ -22,6 +22,7 @@ export class RegisterComponent implements OnInit {
form: FormGroup;
public missingToken: boolean;
public success: boolean;
public working: boolean;
items = [];
currentLocale: String;
@@ -73,22 +74,38 @@ export class RegisterComponent implements OnInit {
if (this.form.valid && !this.working) {
this.working = true;
let pgpOption = {
userIds: [{ name: this.model.username, email: this.model.email }],
numBits: 4096,
userIds: [{ name: this.model.username, email: this.model.username + "@we.bstly.de" }],
curve: "ed25519",
}
var pubKey, privKey
openpgp.generateKey(pgpOption).then((key) => {
privKey = key.privateKeyArmored
pubKey = key.publicKeyArmored
privKey = key.privateKeyArmored;
pubKey = key.publicKeyArmored;
this.model.publicKey = pubKey;
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,
data: result
});
dialogRef.afterClosed().subscribe(result => {
if (result) {
this.success = true;
}
});
this.working = false;
}, (error) => {
this.working = false;
@@ -106,7 +123,6 @@ export class RegisterComponent implements OnInit {
}
}
})
})
}
}
@@ -124,9 +140,4 @@ export class RegisterDialog {
public dialogRef: MatDialogRef<RegisterDialog>,
@Inject(MAT_DIALOG_DATA) public data: any) { }
onOkClick(): void {
this.dialogRef.close();
this.router.navigate(["/login"]);
}
}
+7 -5
View File
@@ -1,18 +1,20 @@
<h1 mat-dialog-title>{{data.username}}</h1>
<div mat-dialog-content>
<h3>Permissions</h3>
<h3>{{'permissions' | i18n}}</h3>
<app-permissions [permissions]="data.permissions"></app-permissions>
<h3>Quotas</h3>
<h3>{{'quotas' | i18n}}</h3>
<app-quotas [quotas]="data.quotas"></app-quotas>
<h3>{{'pgp.privateKey' | i18n}}</h3>
<mat-form-field>
<mat-label>Private PGP key</mat-label>
<qrcode [qrdata]="data.privateKey" [width]="400" [errorCorrectionLevel]="'M'"></qrcode>
<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">
I have saved my private key securely!
{{'pgp.privateKey.confirmStore' | i18n}}
</mat-slide-toggle>
<button mat-button (click)="onOkClick()" [disabled]="!data.confirmClose">Ok</button>
<button mat-button [disabled]="!data.confirmClose" [mat-dialog-close]="true">{{'ok' | i18n}}</button>
</div>
@@ -49,8 +49,6 @@ export class UsernameDialog {
};
this.username = uniqueNamesGenerator(config);
console.log(this.username);
}
toggle(dict) {
+2 -1
View File
@@ -46,7 +46,8 @@
<a *ngIf="!auth.authenticated" routerLink="/register" mat-raised-button color="accent">
<mat-icon>how_to_reg</mat-icon> {{'register' | i18n}}
</a>
<a *ngIf="!auth.authenticated" routerLink="/login" mat-raised-button color="primary">
<a *ngIf="!auth.authenticated" routerLink="/login" [queryParams]="{ target:'tokens' }" mat-raised-button
color="primary">
<mat-icon>login</mat-icon> {{'login' | i18n}}
</a>
</mat-card-actions>
+2 -2
View File
@@ -36,7 +36,7 @@ export class TokensComponent implements OnInit {
private route: ActivatedRoute) {
this.currentLocale = this.i18n.getLocale();
this.authService.auth.subscribe(data => {
this.auth = data;
})
@@ -97,7 +97,7 @@ export class TokensComponent implements OnInit {
redeem() {
if (this.auth.authenticated) {
this.itemService.redeem().subscribe((data: any) => {
this.router.navigate(["/account/info"]);
})
}
}