<form [formGroup]="form" (ngSubmit)="passwordRequest()">
    <mat-card>
        <mat-card-content>
            <h2>{{'password.request' | i18n}}</h2>
            <mat-form-field>
                <input matInput placeholder="{{'username' | i18n}}" formControlName="username" [(ngModel)]="model.username">
                <mat-error>
                    {{'username.missing' | i18n}}
                </mat-error>
            </mat-form-field>
            
            <mat-form-field>
                <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.request' | i18n}}
            </button>

            <mat-progress-bar *ngIf="working" mode="indeterminate"></mat-progress-bar>
        </mat-card-actions>
    </mat-card>
</form>