diff --git a/src/app/settings/account.component.html b/src/app/settings/account.component.html index 5d9b17dd1d..631046d8f4 100644 --- a/src/app/settings/account.component.html +++ b/src/app/settings/account.component.html @@ -1,3 +1,34 @@ +
+ +
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+
+ +
+
+

Change Email

+
+
+

Change Master Password

+
diff --git a/src/app/settings/account.component.ts b/src/app/settings/account.component.ts index df1efb9d99..12f5b5edd6 100644 --- a/src/app/settings/account.component.ts +++ b/src/app/settings/account.component.ts @@ -1,9 +1,51 @@ import { Component, + OnInit, } from '@angular/core'; +import { ToasterService } from 'angular2-toaster'; +import { Angulartics2 } from 'angulartics2'; + +import { ApiService } from 'jslib/abstractions/api.service'; +import { I18nService } from 'jslib/abstractions/i18n.service'; + +import { UpdateProfileRequest } from 'jslib/models/request/updateProfileRequest'; + +import { ProfileResponse } from 'jslib/models/response/profileResponse'; + @Component({ selector: 'app-account', templateUrl: 'account.component.html', }) -export class AccountComponent { } +export class AccountComponent implements OnInit { + loading = true; + profile: ProfileResponse; + + submitPromise: Promise; + + constructor(private apiService: ApiService, private i18nService: I18nService, + private analytics: Angulartics2, private toasterService: ToasterService, ) { } + + async ngOnInit() { + this.profile = await this.apiService.getProfile(); + this.loading = false; + } + + async submit() { + try { + const request = new UpdateProfileRequest(this.profile.name, this.profile.masterPasswordHint); + this.submitPromise = this.apiService.putProfile(request); + await this.submitPromise; + this.analytics.eventTrack.next({ action: 'Updated Profile' }); + this.toasterService.popAsync('success', null, this.i18nService.t('accountUpdated')); + } catch { } + } + + changePassword() { + + } + + changeEmail() { + + } +} diff --git a/src/app/tools/password-generator.component.html b/src/app/tools/password-generator.component.html index 0613efe550..d762bb589c 100644 --- a/src/app/tools/password-generator.component.html +++ b/src/app/tools/password-generator.component.html @@ -6,7 +6,6 @@ {{password}} -

{{'options' | i18n}}

diff --git a/src/locales/en/messages.json b/src/locales/en/messages.json index 46327efb50..6db337eaca 100644 --- a/src/locales/en/messages.json +++ b/src/locales/en/messages.json @@ -506,6 +506,9 @@ "masterPassHint": { "message": "Master Password Hint (optional)" }, + "masterPassHintLabel": { + "message": "Master Password Hint" + }, "settings": { "message": "Settings" }, @@ -752,9 +755,6 @@ "length": { "message": "Length" }, - "options": { - "message": "Options" - }, "passwordHistory": { "message": "Password History" }, @@ -763,5 +763,8 @@ }, "clear": { "message": "Clear" + }, + "accountUpdated": { + "message": "Account Updated" } } diff --git a/src/scss/styles.scss b/src/scss/styles.scss index 210f4efa34..cba070815c 100644 --- a/src/scss/styles.scss +++ b/src/scss/styles.scss @@ -68,7 +68,7 @@ body { } } -.page-header { +.page-header, .secondary-header { border-bottom: 1px solid $border-color; padding-bottom: 0.6rem; margin-bottom: 0.5rem; @@ -78,6 +78,10 @@ body { } } +.secondary-header { + margin-top: 4rem; +} + .navbar { padding-left: 0; padding-right: 0;