update clipboard, fix timeslots
This commit is contained in:
@@ -1,17 +1,16 @@
|
||||
import {Component, OnInit, ElementRef, ViewChild} from '@angular/core';
|
||||
import {MatDialogRef} from '@angular/material/dialog';
|
||||
import {MatSnackBar} from '@angular/material/snack-bar';
|
||||
|
||||
import {AuthService} from '../../../../services/auth.service';
|
||||
import {I18nService} from '../../../../services/i18n.service';
|
||||
|
||||
import { Component, OnInit, ElementRef, ViewChild } from '@angular/core';
|
||||
import { MatDialogRef } from '@angular/material/dialog';
|
||||
import { MatSnackBar } from '@angular/material/snack-bar';
|
||||
import { Clipboard } from '@angular/cdk/clipboard';
|
||||
|
||||
import { AuthService } from '../../../../services/auth.service';
|
||||
import { I18nService } from '../../../../services/i18n.service';
|
||||
|
||||
var openpgp = require('openpgp');
|
||||
|
||||
@Component({
|
||||
templateUrl: './profilefield.pgp-blob.html',
|
||||
styleUrls: ['./profilefield.pgp-blob.scss']
|
||||
styleUrls: [ './profilefield.pgp-blob.scss' ]
|
||||
})
|
||||
export class ProfileFieldPgpBlob implements OnInit {
|
||||
|
||||
@@ -19,23 +18,24 @@ export class ProfileFieldPgpBlob implements OnInit {
|
||||
|
||||
data: any;
|
||||
|
||||
@ViewChild("downloadKey", {read: ElementRef}) downloadKey: ElementRef;
|
||||
@ViewChild("downloadKey", { read: ElementRef }) downloadKey: ElementRef;
|
||||
constructor(
|
||||
public dialogRef: MatDialogRef<ProfileFieldPgpBlob>,
|
||||
private i18n : I18nService,
|
||||
private i18n: I18nService,
|
||||
private authService: AuthService,
|
||||
private snackBar: MatSnackBar) {
|
||||
private snackBar: MatSnackBar,
|
||||
private clipboard: Clipboard) {
|
||||
this.data = {};
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.authService.auth.subscribe((auth: any) => {
|
||||
if(!auth.authenticated) {
|
||||
if (!auth.authenticated) {
|
||||
return;
|
||||
}
|
||||
|
||||
let pgpOption = {
|
||||
userIds: [{name: auth.principal.username, email: auth.principal.username + "@we.bstly.de"}],
|
||||
userIds: [ { name: auth.principal.username, email: auth.principal.username + "@we.bstly.de" } ],
|
||||
curve: "ed25519",
|
||||
}
|
||||
|
||||
@@ -56,10 +56,7 @@ export class ProfileFieldPgpBlob implements OnInit {
|
||||
}
|
||||
|
||||
copyKey(inputElement) {
|
||||
inputElement.select();
|
||||
document.execCommand('copy');
|
||||
inputElement.setSelectionRange(0, 0);
|
||||
this.downloaded = true;
|
||||
this.clipboard.copy(inputElement.value);
|
||||
this.snackBar.open(this.i18n.get("pgp.privateKey.copied", []), this.i18n.get("close", []), {
|
||||
duration: 3000
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user