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 {
ActivatedRoute,
Router,
NavigationEnd,
} from '@angular/router';
import {

View File

@ -7,13 +7,13 @@
<div class="card-body">
<div class="form-group">
<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 class="form-group">
<label for="masterPassword">{{'masterPass' | i18n}}</label>
<div class="d-flex">
<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()">
<i class="fa fa-lg" [ngClass]="{'fa-eye': !showPassword, 'fa-eye-slash': showPassword}"></i>
</button>
@ -22,6 +22,10 @@
<a routerLink="/hint">{{'getMasterPasswordHint' | i18n}}</a>
</small>
</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>
<div class="d-flex">
<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 { Router } from '@angular/router';
import {
ActivatedRoute,
Router,
} from '@angular/router';
import { ToasterService } from 'angular2-toaster';
import { Angulartics2 } from 'angulartics2';
import { AuthService } from 'jslib/abstractions/auth.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';
@ -16,8 +20,19 @@ import { LoginComponent as BaseLoginComponent } from 'jslib/angular/components/l
export class LoginComponent extends BaseLoginComponent {
constructor(authService: AuthService, router: Router,
analytics: Angulartics2, toasterService: ToasterService,
i18nService: I18nService) {
super(authService, router, analytics, toasterService, i18nService);
i18nService: I18nService, private route: ActivatedRoute,
storageService: StorageService) {
super(authService, router, analytics, toasterService, i18nService, storageService);
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": {
"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 {
private localStorageKeys = new Set(['appId', 'anonymousAppId', 'rememberedEmail', 'passwordGenerationOptions',
ConstantsService.disableFaviconKey, ConstantsService.lockOptionKey,
ConstantsService.disableFaviconKey, ConstantsService.lockOptionKey, 'rememberEmail',
ConstantsService.localeKey, ConstantsService.lockOptionKey]);
private localStorageStartsWithKeys = ['twoFactorToken_'];

View File

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