From e46f3073b4824dcc747793f892798d76decdb2d0 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Thu, 21 Jun 2018 11:43:50 -0400 Subject: [PATCH] move profile to its own component --- src/app/app.module.ts | 2 ++ src/app/settings/account.component.html | 29 +-------------- src/app/settings/account.component.ts | 48 ++----------------------- src/app/settings/profile.component.html | 28 +++++++++++++++ src/app/settings/profile.component.ts | 43 ++++++++++++++++++++++ 5 files changed, 76 insertions(+), 74 deletions(-) create mode 100644 src/app/settings/profile.component.html create mode 100644 src/app/settings/profile.component.ts diff --git a/src/app/app.module.ts b/src/app/app.module.ts index d42e3dee5d..9743cc28f5 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -32,6 +32,7 @@ import { TwoFactorOptionsComponent } from './accounts/two-factor-options.compone import { TwoFactorComponent } from './accounts/two-factor.component'; import { AccountComponent } from './settings/account.component'; +import { ProfileComponent } from './settings/profile.component'; import { SettingsComponent } from './settings/settings.component'; import { ExportComponent } from './tools/export.component'; @@ -116,6 +117,7 @@ import { SearchCiphersPipe } from 'jslib/angular/pipes/search-ciphers.pipe'; OrganizationLayoutComponent, PasswordGeneratorComponent, PasswordGeneratorHistoryComponent, + ProfileComponent, RegisterComponent, SearchCiphersPipe, SettingsComponent, diff --git a/src/app/settings/account.component.html b/src/app/settings/account.component.html index e05196a215..2ea92bb1da 100644 --- a/src/app/settings/account.component.html +++ b/src/app/settings/account.component.html @@ -1,34 +1,7 @@ -
- -
-
-
-
-
- - -
-
- - -
-
- - -
-
-
- -
-
- -
+

Change Email

diff --git a/src/app/settings/account.component.ts b/src/app/settings/account.component.ts index 12f5b5edd6..57e8fc373c 100644 --- a/src/app/settings/account.component.ts +++ b/src/app/settings/account.component.ts @@ -1,51 +1,7 @@ -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'; +import { Component } from '@angular/core'; @Component({ selector: 'app-account', templateUrl: 'account.component.html', }) -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() { - - } -} +export class AccountComponent { } diff --git a/src/app/settings/profile.component.html b/src/app/settings/profile.component.html new file mode 100644 index 0000000000..750c00d7bc --- /dev/null +++ b/src/app/settings/profile.component.html @@ -0,0 +1,28 @@ +
+ +
+
+
+
+
+ + +
+
+ + +
+
+ + +
+
+
+ +
+
+ +
diff --git a/src/app/settings/profile.component.ts b/src/app/settings/profile.component.ts new file mode 100644 index 0000000000..fa2a2b55a5 --- /dev/null +++ b/src/app/settings/profile.component.ts @@ -0,0 +1,43 @@ +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-profile', + templateUrl: 'profile.component.html', +}) +export class ProfileComponent implements OnInit { + loading = true; + profile: ProfileResponse; + + formPromise: 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.formPromise = this.apiService.putProfile(request); + await this.formPromise; + this.analytics.eventTrack.next({ action: 'Updated Profile' }); + this.toasterService.popAsync('success', null, this.i18nService.t('accountUpdated')); + } catch { } + } +}