Commit 31ad3097 authored by Emily Jensen's avatar Emily Jensen

Merge branch '188-account-recovery-mobile' into 'dev'

#188 refactor learn more component to work with mobile

Closes #188

See merge request passit/passit-frontend!171
parents 871b7561 c2b163f0
Pipeline #39931871 passed with stage
in 5 minutes and 14 seconds
......@@ -38,6 +38,8 @@ import { TNSLoginEffects } from "./login/tns-login-effects";
import { MobileMenuModule } from "../mobile-menu";
import { ResetPasswordContainer } from "./reset-password/reset-password.container";
import { ResetPasswordComponent } from "./reset-password/reset-password.component";
import { ForgotLearnMoreContainer } from "./change-password/forgot-learn-more/forgot-learn-more.container";
import { ForgotLearnMoreComponent } from "./change-password/forgot-learn-more/forgot-learn-more.component";
export const COMPONENTS = [
LoginContainer,
......@@ -52,7 +54,9 @@ export const COMPONENTS = [
ResetPasswordComponent,
ResetPasswordContainer,
ErrorReportingComponent,
ErrorReportingContainer
ErrorReportingContainer,
ForgotLearnMoreContainer,
ForgotLearnMoreComponent
];
export const SERVICES = [BackupCodePdfService, UserService, ConfirmEmailGuard];
......
......@@ -48,6 +48,7 @@ import { RegisterContainer } from "./register/register.container";
import { RegisterComponent } from "./register/register.component";
import { LoginComponent } from "./login/login.component";
import { LoginContainer } from "./login/login.container";
import { ForgotLearnMoreContainer } from "./change-password/forgot-learn-more/forgot-learn-more.container";
import { ForgotLearnMoreComponent } from "./change-password/forgot-learn-more/forgot-learn-more.component";
import { ConfirmEmailGuard } from "./confirm-email/confirm-email.guard";
import { UserService } from "./user";
......@@ -80,6 +81,7 @@ export const COMPONENTS = [
ManageBackupCodeContainer,
MarketingFrameComponent,
ServerSelectComponent,
ForgotLearnMoreContainer,
ForgotLearnMoreComponent
];
......
<Button text="forgot-learn-more works!" class="btn btn-primary"></Button>
\ No newline at end of file
<Button (tap)="onLogOut()" text="forgot-learn-more works!" class="btn btn-primary"></Button>
\ No newline at end of file
import { Component, EventEmitter, Input, Output } from "@angular/core";
import * as dialogs from "tns-core-modules/ui/dialogs";
@Component({
selector: "forgot-learn-more",
templateUrl: "./forgot-learn-more.component.html",
styleUrls: ["./forgot-learn-more.component.css"]
})
export class ForgotLearnMoreComponent {
@Input() confirmText: string;
@Output() logOut = new EventEmitter();
onLogOut() {
dialogs
.confirm({
message: this.confirmText,
okButtonText: "Log Out",
cancelButtonText: "Cancel"
})
.then(result => result && this.logOut.emit());
}
}
import { Component } from "@angular/core";
import { Store } from "@ngrx/store";
import { IState } from "../../../app.reducers";
import { LogoutAction } from "../.././account.actions";
import { Component, EventEmitter, Input, Output } from "@angular/core";
@Component({
selector: "forgot-learn-more",
templateUrl: "./forgot-learn-more.component.html",
styleUrls: [
"./forgot-learn-more.component.css",
"../../account.component.scss",
"../../account.component.scss"
]
})
export class ForgotLearnMoreComponent {
constructor(private store: Store<IState>) {}
@Input() confirmText: string;
@Output() logOut = new EventEmitter();
onLogOut() {
if (
window.confirm("Please confirm that you have your backup code ready before logging out.")
) {
this.store.dispatch(new LogoutAction());
if (window.confirm(this.confirmText)) {
this.logOut.emit();
}
}
}
import { Component } from "@angular/core";
import { Store } from "@ngrx/store";
import { IState } from "../../../app.reducers";
import { LogoutAction } from "../.././account.actions";
@Component({
selector: "forgot-learn-more-container",
template: `
<forgot-learn-more
[confirmText]="confirmText"
(logOut)="logOut()"
></forgot-learn-more>
`
})
export class ForgotLearnMoreContainer {
confirmText =
"Please confirm that you have your backup code ready before logging out.";
constructor(private store: Store<IState>) {}
logOut() {
this.store.dispatch(new LogoutAction());
}
}
......@@ -13,6 +13,7 @@ import { ConfirmEmailGuard } from "./account/confirm-email/confirm-email.guard";
import { ErrorReportingContainer } from "./account/error-reporting/error-reporting.container";
import { ChangePasswordContainer } from "./account/change-password";
import { ResetPasswordContainer } from "./account/reset-password/reset-password.container";
import { ForgotLearnMoreContainer } from "./account/change-password/forgot-learn-more/forgot-learn-more.container";
export const routes: Routes = [
{
......@@ -55,6 +56,14 @@ export const routes: Routes = [
title: "Error Reporting"
}
},
{
path: "account/forgot-password",
component: ForgotLearnMoreContainer,
canActivate: [LoggedInGuard],
data: {
title: "Forgot Your Password?"
}
},
{
path: "account/change-password",
component: ChangePasswordContainer,
......
......@@ -24,7 +24,7 @@ import { ManageBackupCodeContainer } from "./account/manage-backup-code/manage-b
import { ResetPasswordContainer } from "./account/reset-password/reset-password.container";
import { ResetPasswordVerifyContainer } from "./account/reset-password/reset-password-verify/reset-password-verify.container";
import { SetPasswordContainer } from "./account/reset-password/set-password/set-password.container";
import { ForgotLearnMoreComponent } from "./account/change-password/forgot-learn-more/forgot-learn-more.component";
import { ForgotLearnMoreContainer } from "./account/change-password/forgot-learn-more/forgot-learn-more.container";
/* tslint:disable:object-literal-sort-keys */
const appRoutes: Routes = [
......@@ -55,7 +55,7 @@ const appRoutes: Routes = [
},
{
path: "account/forgot-password",
component: ForgotLearnMoreComponent,
component: ForgotLearnMoreContainer,
canActivate: [LoggedInGuard],
data: {
title: "Forgot Your Password?"
......
......@@ -38,7 +38,8 @@ export class SideDrawer {
// {title: "Groups"},
{ title: "Change Account Password" },
{ title: "Error Reporting" },
{ title: "Log Out" }
{ title: "Log Out" },
{ title: "Forgot Password?" },
],
textColor: new Color("black"),
headerBackgroundColor: new Color("#0092A8"),
......@@ -69,6 +70,11 @@ export class SideDrawer {
case 3:
this.store.dispatch(new LogoutAction());
return;
case 4:
this.zone.run(() =>
this.router.navigate(["/account/forgot-password"])
);
return;
}
}
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment