-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #520 from Senyoret1/pass
Add password options to the UI of the proxy and vpn client apps
- Loading branch information
Showing
10 changed files
with
188 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...skysocks-client-settings/skysocks-client-password/skysocks-client-password.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<app-dialog [headline]="'apps.vpn-socks-client-settings.password-dialog.title' | translate"> | ||
<form [formGroup]="form"> | ||
<div class="info">{{ 'apps.vpn-socks-client-settings.password-dialog.info' | translate }}</div> | ||
<mat-form-field> | ||
<input | ||
#firstInput | ||
[placeholder]="'apps.vpn-socks-client-settings.password-dialog.password' | translate" | ||
type="password" | ||
id="password" | ||
formControlName="password" | ||
maxlength="100" | ||
matInput | ||
> | ||
</mat-form-field> | ||
<app-button class="float-right" color="primary" type="mat-raised-button" (action)="finish()"> | ||
{{ 'apps.vpn-socks-client-settings.password-dialog.continue-button' | translate }} | ||
</app-button> | ||
</form> | ||
</app-dialog> |
6 changes: 6 additions & 0 deletions
6
...skysocks-client-settings/skysocks-client-password/skysocks-client-password.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
@import "variables"; | ||
|
||
.info { | ||
font-size: $font-size-mini; | ||
margin-bottom: 15px; | ||
} |
52 changes: 52 additions & 0 deletions
52
...s/skysocks-client-settings/skysocks-client-password/skysocks-client-password.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { Component, ViewChild, ElementRef, OnInit } from '@angular/core'; | ||
import { MatDialogRef, MatDialogConfig, MatDialog } from '@angular/material/dialog'; | ||
import { FormGroup, FormBuilder } from '@angular/forms'; | ||
|
||
import { AppConfig } from 'src/app/app.config'; | ||
|
||
/** | ||
* Modal window for entering the password for connecting to a backend shown by the history of | ||
* SkysocksClientSettingsComponent. If the user presses the continue button, the modal window | ||
* is closed and the password is returned in the "afterClosed" envent, but with an hyphen "-" | ||
* added to the begining, to help avoiding problems while checking empty strings. | ||
*/ | ||
@Component({ | ||
selector: 'app-skysocks-client-password', | ||
templateUrl: './skysocks-client-password.component.html', | ||
styleUrls: ['./skysocks-client-password.component.scss'] | ||
}) | ||
export class SkysocksClientPasswordComponent implements OnInit { | ||
@ViewChild('firstInput', { static: false }) firstInput: ElementRef; | ||
|
||
form: FormGroup; | ||
|
||
/** | ||
* Opens the modal window. Please use this function instead of opening the window "by hand". | ||
*/ | ||
public static openDialog(dialog: MatDialog): MatDialogRef<SkysocksClientPasswordComponent, any> { | ||
const config = new MatDialogConfig(); | ||
config.autoFocus = false; | ||
config.width = AppConfig.smallModalWidth; | ||
|
||
return dialog.open(SkysocksClientPasswordComponent, config); | ||
} | ||
|
||
constructor( | ||
private dialogRef: MatDialogRef<SkysocksClientPasswordComponent>, | ||
private formBuilder: FormBuilder, | ||
) { } | ||
|
||
ngOnInit() { | ||
this.form = this.formBuilder.group({ | ||
'password': [''], | ||
}); | ||
|
||
setTimeout(() => (this.firstInput.nativeElement as HTMLElement).focus()); | ||
} | ||
|
||
// Closes the modal window and returns the password. | ||
finish() { | ||
const password = this.form.get('password').value; | ||
this.dialogRef.close('-' + password); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters