diff --git a/src/app/accounts/lock.component.html b/src/app/accounts/lock.component.html
new file mode 100644
index 00000000..53293576
--- /dev/null
+++ b/src/app/accounts/lock.component.html
@@ -0,0 +1,34 @@
+
diff --git a/src/app/accounts/lock.component.ts b/src/app/accounts/lock.component.ts
new file mode 100644
index 00000000..39fced9b
--- /dev/null
+++ b/src/app/accounts/lock.component.ts
@@ -0,0 +1,27 @@
+import { Component } from '@angular/core';
+import { Router } from '@angular/router';
+
+import { ToasterService } from 'angular2-toaster';
+import { Angulartics2 } from 'angulartics2';
+
+import { CryptoService } from 'jslib/abstractions/crypto.service';
+import { I18nService } from 'jslib/abstractions/i18n.service';
+import { MessagingService } from 'jslib/abstractions/messaging.service';
+import { PlatformUtilsService } from 'jslib/abstractions/platformUtils.service';
+import { UserService } from 'jslib/abstractions/user.service';
+
+import { LockComponent as BaseLockComponent } from 'jslib/angular/components/lock.component';
+
+@Component({
+ selector: 'app-lock',
+ templateUrl: 'lock.component.html',
+})
+export class LockComponent extends BaseLockComponent {
+ constructor(router: Router, analytics: Angulartics2,
+ toasterService: ToasterService, i18nService: I18nService,
+ platformUtilsService: PlatformUtilsService, messagingService: MessagingService,
+ userService: UserService, cryptoService: CryptoService) {
+ super(router, analytics, toasterService, i18nService, platformUtilsService,
+ messagingService, userService, cryptoService);
+ }
+}
diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts
index b7f8923f..02db826a 100644
--- a/src/app/app-routing.module.ts
+++ b/src/app/app-routing.module.ts
@@ -9,6 +9,7 @@ import { OrganizationLayoutComponent } from './layouts/organization-layout.compo
import { UserLayoutComponent } from './layouts/user-layout.component';
import { HintComponent } from './accounts/hint.component';
+import { LockComponent } from './accounts/lock.component';
import { LoginComponent } from './accounts/login.component';
import { RegisterComponent } from './accounts/register.component';
import { TwoFactorComponent } from './accounts/two-factor.component';
@@ -32,6 +33,7 @@ const routes: Routes = [
{ path: '2fa', component: TwoFactorComponent },
{ path: 'register', component: RegisterComponent },
{ path: 'hint', component: HintComponent },
+ { path: 'lock', component: LockComponent },
],
},
{
diff --git a/src/app/app.component.ts b/src/app/app.component.ts
index b806a07e..599e00d6 100644
--- a/src/app/app.component.ts
+++ b/src/app/app.component.ts
@@ -1,3 +1,7 @@
+import * as jq from 'jquery';
+import * as _swal from 'sweetalert';
+import { SweetAlert } from 'sweetalert/typings/core';
+
import {
ToasterConfig,
ToasterContainerComponent,
@@ -11,7 +15,10 @@ import {
OnDestroy,
OnInit,
} from '@angular/core';
-import { Router } from '@angular/router';
+import {
+ NavigationEnd,
+ Router,
+} from '@angular/router';
import { BroadcasterService } from 'jslib/angular/services/broadcaster.service';
@@ -34,6 +41,8 @@ import { UserService } from 'jslib/abstractions/user.service';
import { ConstantsService } from 'jslib/services/constants.service';
const BroadcasterSubscriptionId = 'AppComponent';
+// Hack due to Angular 5.2 bug
+const swal: SweetAlert = _swal as any;
@Component({
selector: 'app-root',
@@ -94,6 +103,19 @@ export class AppComponent implements OnDestroy, OnInit {
}
});
});
+
+ this.router.events.subscribe((event) => {
+ if (event instanceof NavigationEnd) {
+ const modals = Array.from(document.querySelectorAll('.modal'));
+ for (const modal of modals) {
+ (jq(modal) as any).modal('hide');
+ }
+
+ if (document.querySelector('.swal-modal') != null) {
+ swal.close(undefined);
+ }
+ }
+ });
}
ngOnDestroy() {
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index e473ba94..6ea2a21c 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -23,6 +23,7 @@ import { OrganizationLayoutComponent } from './layouts/organization-layout.compo
import { UserLayoutComponent } from './layouts/user-layout.component';
import { HintComponent } from './accounts/hint.component';
+import { LockComponent } from './accounts/lock.component';
import { LoginComponent } from './accounts/login.component';
import { RegisterComponent } from './accounts/register.component';
import { TwoFactorOptionsComponent } from './accounts/two-factor-options.component';
@@ -83,6 +84,7 @@ import { Folder } from 'jslib/models/domain';
IconComponent,
I18nPipe,
InputVerbatimDirective,
+ LockComponent,
LoginComponent,
ModalComponent,
NavbarComponent,
diff --git a/src/locales/en/messages.json b/src/locales/en/messages.json
index 48aa172d..3d495d82 100644
--- a/src/locales/en/messages.json
+++ b/src/locales/en/messages.json
@@ -532,5 +532,14 @@
},
"emailAddress": {
"message": "Email Address"
+ },
+ "yourVaultIsLocked": {
+ "message": "Your vault is locked. Verify your master password to continue."
+ },
+ "unlock": {
+ "message": "Unlock"
+ },
+ "invalidMasterPassword": {
+ "message": "Invalid master password"
}
}