1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-27 12:36:14 +01:00

remember email on login

This commit is contained in:
Kyle Spearrin 2018-07-13 09:13:37 -04:00
parent 1dc4f851cb
commit e5733b83a0
7 changed files with 29 additions and 10 deletions

2
jslib

@ -1 +1 @@
Subproject commit cc6f732a140e5f49f0c2fe22c34da660ffe5ea89 Subproject commit 0217fdf7c1f402974e9ed80e216d84dffb88a696

View File

@ -5,7 +5,6 @@ import {
import { import {
ActivatedRoute, ActivatedRoute,
Router, Router,
NavigationEnd,
} from '@angular/router'; } from '@angular/router';
import { import {

View File

@ -7,13 +7,13 @@
<div class="card-body"> <div class="card-body">
<div class="form-group"> <div class="form-group">
<label for="email">{{'emailAddress' | i18n}}</label> <label for="email">{{'emailAddress' | i18n}}</label>
<input id="email" class="form-control" type="text" name="Email" [(ngModel)]="email" required [appAutofocus]="email === ''"> <input id="email" class="form-control" type="text" name="Email" [(ngModel)]="email" required>
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="masterPassword">{{'masterPass' | i18n}}</label> <label for="masterPassword">{{'masterPass' | i18n}}</label>
<div class="d-flex"> <div class="d-flex">
<input id="masterPassword" type="{{showPassword ? 'text' : 'password'}}" name="MasterPassword" class="text-monospace form-control" <input id="masterPassword" type="{{showPassword ? 'text' : 'password'}}" name="MasterPassword" class="text-monospace form-control"
[(ngModel)]="masterPassword" required [appAutofocus]="email !== ''"> [(ngModel)]="masterPassword" required>
<button type="button" class="ml-1 btn btn-link" appBlurClick title="{{'toggleVisibility' | i18n}}" (click)="togglePassword()"> <button type="button" class="ml-1 btn btn-link" appBlurClick title="{{'toggleVisibility' | i18n}}" (click)="togglePassword()">
<i class="fa fa-lg" [ngClass]="{'fa-eye': !showPassword, 'fa-eye-slash': showPassword}"></i> <i class="fa fa-lg" [ngClass]="{'fa-eye': !showPassword, 'fa-eye-slash': showPassword}"></i>
</button> </button>
@ -22,6 +22,10 @@
<a routerLink="/hint">{{'getMasterPasswordHint' | i18n}}</a> <a routerLink="/hint">{{'getMasterPasswordHint' | i18n}}</a>
</small> </small>
</div> </div>
<div class="form-check">
<input type="checkbox" class="form-check-input" id="rememberEmail" name="RememberEmail" [(ngModel)]="rememberEmail">
<label class="form-check-label" for="rememberEmail">{{'rememberEmail' | i18n}}</label>
</div>
<hr> <hr>
<div class="d-flex"> <div class="d-flex">
<button type="submit" class="btn btn-primary btn-block" [disabled]="form.loading" appBlurClick> <button type="submit" class="btn btn-primary btn-block" [disabled]="form.loading" appBlurClick>

View File

@ -1,11 +1,15 @@
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { Router } from '@angular/router'; import {
ActivatedRoute,
Router,
} from '@angular/router';
import { ToasterService } from 'angular2-toaster'; import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2'; import { Angulartics2 } from 'angulartics2';
import { AuthService } from 'jslib/abstractions/auth.service'; import { AuthService } from 'jslib/abstractions/auth.service';
import { I18nService } from 'jslib/abstractions/i18n.service'; import { I18nService } from 'jslib/abstractions/i18n.service';
import { StorageService } from 'jslib/abstractions/storage.service';
import { LoginComponent as BaseLoginComponent } from 'jslib/angular/components/login.component'; import { LoginComponent as BaseLoginComponent } from 'jslib/angular/components/login.component';
@ -16,8 +20,19 @@ import { LoginComponent as BaseLoginComponent } from 'jslib/angular/components/l
export class LoginComponent extends BaseLoginComponent { export class LoginComponent extends BaseLoginComponent {
constructor(authService: AuthService, router: Router, constructor(authService: AuthService, router: Router,
analytics: Angulartics2, toasterService: ToasterService, analytics: Angulartics2, toasterService: ToasterService,
i18nService: I18nService) { i18nService: I18nService, private route: ActivatedRoute,
super(authService, router, analytics, toasterService, i18nService); storageService: StorageService) {
super(authService, router, analytics, toasterService, i18nService, storageService);
this.successRoute = '/vault'; this.successRoute = '/vault';
} }
async ngOnInit() {
this.route.queryParams.subscribe(async (qParams) => {
if (qParams.email != null && qParams.email.indexOf('@') > -1) {
this.email = qParams.email;
}
await super.ngOnInit();
document.getElementById(this.email == null || this.email === '' ? 'email' : 'masterPassword').focus();
});
}
} }

View File

@ -2122,5 +2122,8 @@
}, },
"inviteAcceptFailed": { "inviteAcceptFailed": {
"message": "Unable to accept invitation. Ask an organization admin to send a new invitation." "message": "Unable to accept invitation. Ask an organization admin to send a new invitation."
},
"rememberEmail": {
"message": "Remember email"
} }
} }

View File

@ -3,7 +3,7 @@ import { ConstantsService } from 'jslib/services';
export class HtmlStorageService implements StorageService { export class HtmlStorageService implements StorageService {
private localStorageKeys = new Set(['appId', 'anonymousAppId', 'rememberedEmail', 'passwordGenerationOptions', private localStorageKeys = new Set(['appId', 'anonymousAppId', 'rememberedEmail', 'passwordGenerationOptions',
ConstantsService.disableFaviconKey, ConstantsService.lockOptionKey, ConstantsService.disableFaviconKey, ConstantsService.lockOptionKey, 'rememberEmail',
ConstantsService.localeKey, ConstantsService.lockOptionKey]); ConstantsService.localeKey, ConstantsService.lockOptionKey]);
private localStorageStartsWithKeys = ['twoFactorToken_']; private localStorageStartsWithKeys = ['twoFactorToken_'];

View File

@ -4,10 +4,8 @@ import { SweetAlert } from 'sweetalert/typings/core';
import { DeviceType } from 'jslib/enums/deviceType'; import { DeviceType } from 'jslib/enums/deviceType';
import { I18nService } from 'jslib/abstractions/i18n.service'; import { I18nService } from 'jslib/abstractions/i18n.service';
import { MessagingService } from 'jslib/abstractions/messaging.service';
import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service'; import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
import { AnalyticsIds } from 'jslib/misc/analytics';
import { Utils } from 'jslib/misc/utils'; import { Utils } from 'jslib/misc/utils';
// Hack due to Angular 5.2 bug // Hack due to Angular 5.2 bug