mirror of
https://github.com/bitwarden/browser
synced 2025-12-20 18:23:31 +00:00
[SG-742] (#4190)
* Remove default landing on masterpassword page * Remove rememberEmail state service value that isn't needed * Remove last occurence of setRememberEmail * Remove alwaysRememberEmail functionality * Remove always remember email from browser and add option to * Add extra spacing around remember email check * [SG-884] Fix Remember Email functionality for Login with SSO (#4238) * Add saveEmailSettings method to LoginService * Add StateService as a dependency to LoginService * Update login components to utilize new login service method for saving rememberedEmail
This commit is contained in:
@@ -9,9 +9,18 @@
|
||||
<label for="email">{{ "emailAddress" | i18n }}</label>
|
||||
<input id="email" type="email" formControlName="email" appInputVerbatim="false" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-footer no-margin" *ngIf="selfHostedDomain">
|
||||
{{ "loggingInTo" | i18n: selfHostedDomain }}
|
||||
<div class="box-footer no-margin" *ngIf="selfHostedDomain">
|
||||
{{ "loggingInTo" | i18n: selfHostedDomain }}
|
||||
</div>
|
||||
<div class="remember-email-check">
|
||||
<input
|
||||
id="rememberEmail"
|
||||
type="checkbox"
|
||||
name="rememberEmail"
|
||||
formControlName="rememberEmail"
|
||||
/>
|
||||
<label for="rememberEmail">{{ "rememberEmail" | i18n }}</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box">
|
||||
@@ -22,10 +31,10 @@
|
||||
</form>
|
||||
<p class="createAccountLink">
|
||||
{{ "newAroundHere" | i18n }}
|
||||
<a routerLink="/register">{{ "createAccount" | i18n }}</a>
|
||||
<a routerLink="/register" (click)="setFormValues()">{{ "createAccount" | i18n }}</a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<button type="button" routerLink="/environment" class="settings-icon">
|
||||
<button type="button" routerLink="/environment" class="settings-icon" (click)="setFormValues()">
|
||||
<i class="bwi bwi-cog-f bwi-lg" aria-hidden="true"></i><span> {{ "settings" | i18n }}</span>
|
||||
</button>
|
||||
|
||||
@@ -4,6 +4,7 @@ import { ActivatedRoute, Router } from "@angular/router";
|
||||
|
||||
import { EnvironmentService } from "@bitwarden/common/abstractions/environment.service";
|
||||
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
|
||||
import { LoginService } from "@bitwarden/common/abstractions/login.service";
|
||||
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
|
||||
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
||||
|
||||
@@ -16,6 +17,7 @@ export class HomeComponent implements OnInit {
|
||||
|
||||
formGroup = this.formBuilder.group({
|
||||
email: ["", [Validators.required, Validators.email]],
|
||||
rememberEmail: [false],
|
||||
});
|
||||
|
||||
constructor(
|
||||
@@ -25,12 +27,26 @@ export class HomeComponent implements OnInit {
|
||||
private router: Router,
|
||||
private i18nService: I18nService,
|
||||
private environmentService: EnvironmentService,
|
||||
private route: ActivatedRoute
|
||||
private route: ActivatedRoute,
|
||||
private loginService: LoginService
|
||||
) {}
|
||||
async ngOnInit(): Promise<void> {
|
||||
const rememberedEmail = await this.stateService.getRememberedEmail();
|
||||
if (rememberedEmail != null) {
|
||||
this.formGroup.patchValue({ email: await this.stateService.getRememberedEmail() });
|
||||
let savedEmail = this.loginService.getEmail();
|
||||
const rememberEmail = this.loginService.getRememberEmail();
|
||||
|
||||
if (savedEmail != null) {
|
||||
this.formGroup.patchValue({
|
||||
email: savedEmail,
|
||||
rememberEmail: rememberEmail,
|
||||
});
|
||||
} else {
|
||||
savedEmail = await this.stateService.getRememberedEmail();
|
||||
if (savedEmail != null) {
|
||||
this.formGroup.patchValue({
|
||||
email: savedEmail,
|
||||
rememberEmail: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,12 +61,17 @@ export class HomeComponent implements OnInit {
|
||||
return;
|
||||
}
|
||||
|
||||
this.stateService.setRememberedEmail(this.formGroup.value.email);
|
||||
|
||||
this.loginService.setEmail(this.formGroup.value.email);
|
||||
this.loginService.setRememberEmail(this.formGroup.value.rememberEmail);
|
||||
this.router.navigate(["login"], { queryParams: { email: this.formGroup.value.email } });
|
||||
}
|
||||
|
||||
get selfHostedDomain() {
|
||||
return this.environmentService.hasBaseUrl() ? this.environmentService.getWebVaultUrl() : null;
|
||||
}
|
||||
|
||||
setFormValues() {
|
||||
this.loginService.setEmail(this.formGroup.value.email);
|
||||
this.loginService.setRememberEmail(this.formGroup.value.rememberEmail);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,8 +23,6 @@ import { Utils } from "@bitwarden/common/misc/utils";
|
||||
templateUrl: "login.component.html",
|
||||
})
|
||||
export class LoginComponent extends BaseLoginComponent {
|
||||
protected skipRememberEmail = true;
|
||||
|
||||
constructor(
|
||||
apiService: ApiService,
|
||||
appIdService: AppIdService,
|
||||
@@ -73,6 +71,7 @@ export class LoginComponent extends BaseLoginComponent {
|
||||
}
|
||||
|
||||
async launchSsoBrowser() {
|
||||
await this.loginService.saveEmailSettings();
|
||||
// Generate necessary sso params
|
||||
const passwordOptions: any = {
|
||||
type: "password",
|
||||
|
||||
@@ -143,6 +143,12 @@ body.body-full {
|
||||
padding: 30px 10px 0 10px;
|
||||
}
|
||||
|
||||
.remember-email-check {
|
||||
padding-top: 8px;
|
||||
padding-left: 10px;
|
||||
padding-bottom: 18px;
|
||||
}
|
||||
|
||||
.login-buttons > button {
|
||||
margin: 15px 0 15px 0;
|
||||
}
|
||||
|
||||
@@ -367,6 +367,7 @@ function getBgService<T>(service: keyof MainBackground) {
|
||||
{
|
||||
provide: LoginServiceAbstraction,
|
||||
useClass: LoginService,
|
||||
deps: [StateServiceAbstraction],
|
||||
},
|
||||
{
|
||||
provide: AbstractThemingService,
|
||||
|
||||
Reference in New Issue
Block a user