mirror of
https://github.com/bitwarden/browser
synced 2025-12-22 11:13:46 +00:00
password hint page
This commit is contained in:
23
src/app/accounts/hint.component.html
Normal file
23
src/app/accounts/hint.component.html
Normal file
@@ -0,0 +1,23 @@
|
||||
<form id="hint" #form (ngSubmit)="submit()" [appApiAction]="formPromise">
|
||||
<div class="content">
|
||||
<h1>{{'passwordHint' | i18n}}</h1>
|
||||
<div class="box last">
|
||||
<div class="box-content">
|
||||
<div class="box-content-row" appBoxRow>
|
||||
<label for="email">{{'emailAddress' | i18n}}</label>
|
||||
<input id="email" type="text" name="Email" [(ngModel)]="email" required appAutofocus>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
{{'enterEmailToGetHint' | i18n}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="buttons">
|
||||
<button type="submit" class="btn primary block" [disabled]="form.loading" appBlurClick>
|
||||
<span [hidden]="form.loading">{{'submit' | i18n}}</span>
|
||||
<i class="fa fa-spinner fa-spin" [hidden]="!form.loading"></i>
|
||||
</button>
|
||||
<a routerLink="/login" class="btn block">{{'cancel' | i18n}}</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
48
src/app/accounts/hint.component.ts
Normal file
48
src/app/accounts/hint.component.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import * as template from './hint.component.html';
|
||||
|
||||
import {
|
||||
Component,
|
||||
} from '@angular/core';
|
||||
|
||||
import { Router } from '@angular/router';
|
||||
|
||||
import { Angulartics2 } from 'angulartics2';
|
||||
import { ToasterService } from 'angular2-toaster';
|
||||
|
||||
import { PasswordHintRequest } from 'jslib/models/request/passwordHintRequest';
|
||||
|
||||
import { ApiService } from 'jslib/abstractions/api.service';
|
||||
import { I18nService } from 'jslib/abstractions/i18n.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-hint',
|
||||
template: template,
|
||||
})
|
||||
export class HintComponent {
|
||||
email: string = '';
|
||||
formPromise: Promise<any>;
|
||||
|
||||
constructor(private router: Router, private analytics: Angulartics2, private toasterService: ToasterService,
|
||||
private i18nService: I18nService, private apiService: ApiService) { }
|
||||
|
||||
async submit() {
|
||||
if (this.email == null || this.email === '') {
|
||||
this.toasterService.popAsync('error', this.i18nService.t('errorOccurred'),
|
||||
this.i18nService.t('emailRequired'));
|
||||
return;
|
||||
}
|
||||
if (this.email.indexOf('@') === -1) {
|
||||
this.toasterService.popAsync('error', this.i18nService.t('errorOccurred'),
|
||||
this.i18nService.t('invalidEmail'));
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
this.formPromise = this.apiService.postPasswordHint(new PasswordHintRequest(this.email));
|
||||
await this.formPromise;
|
||||
this.analytics.eventTrack.next({ action: 'Requested Hint' });
|
||||
this.toasterService.popAsync('success', null, this.i18nService.t('masterPassSent'));
|
||||
this.router.navigate(['login']);
|
||||
} catch { }
|
||||
}
|
||||
}
|
||||
@@ -26,9 +26,9 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="sub-options">
|
||||
<a href="#">{{'getMasterPasswordHint' | i18n}}</a>
|
||||
<a routerLink="/hint">{{'getMasterPasswordHint' | i18n}}</a>
|
||||
</div>
|
||||
<a href="#" class="settings-icon">
|
||||
<a routerLink="/environment" class="settings-icon">
|
||||
<i class="fa fa-cog fa-lg"></i><span> {{'settings' | i18n}}</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<form id="register" #form (ngSubmit)="submit()" [appApiAction]="formPromise">
|
||||
<div class="content">
|
||||
<p>{{'createAccount' | i18n}}</p>
|
||||
<h1>{{'createAccount' | i18n}}</h1>
|
||||
<div class="box">
|
||||
<div class="box-content">
|
||||
<div class="box-content-row" appBoxRow>
|
||||
|
||||
Reference in New Issue
Block a user