diff --git a/client/proxy.config.json b/client/proxy.config.json
index e5f0dfd61..4a72f1826 100644
--- a/client/proxy.config.json
+++ b/client/proxy.config.json
@@ -8,7 +8,8 @@
"secure": false
},
"/socket.io": {
- "target": "http://localhost:9000",
- "secure": false
+ "target": "ws://localhost:9000",
+ "secure": false,
+ "ws": true
}
}
diff --git a/client/src/app/+my-account/my-account-settings/my-account-change-email/index.ts b/client/src/app/+my-account/my-account-settings/my-account-change-email/index.ts
new file mode 100644
index 000000000..f42af361e
--- /dev/null
+++ b/client/src/app/+my-account/my-account-settings/my-account-change-email/index.ts
@@ -0,0 +1 @@
+export * from './my-account-change-email.component'
diff --git a/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.html b/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.html
new file mode 100644
index 000000000..ebfe3126d
--- /dev/null
+++ b/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.html
@@ -0,0 +1,36 @@
+
{{ error }}
+{{ success }}
+
+
+ Your current email is {{ user.email }}
+
+
+
+ {{ user.pendingEmail }} is awaiting email verification
+
+
+
diff --git a/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.scss b/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.scss
new file mode 100644
index 000000000..81eba3ec9
--- /dev/null
+++ b/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.scss
@@ -0,0 +1,24 @@
+@import '_variables';
+@import '_mixins';
+
+input[type=password],
+input[type=email] {
+ @include peertube-input-text(340px);
+
+ display: block;
+}
+
+input[type=submit] {
+ @include peertube-button;
+ @include orange-button;
+}
+
+.current-email,
+.pending-email {
+ font-size: 16px;
+ margin: 15px 0;
+
+ .email {
+ font-weight: $font-semibold;
+ }
+}
diff --git a/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.ts b/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.ts
new file mode 100644
index 000000000..577c5b102
--- /dev/null
+++ b/client/src/app/+my-account/my-account-settings/my-account-change-email/my-account-change-email.component.ts
@@ -0,0 +1,73 @@
+import { Component, OnInit } from '@angular/core'
+import { AuthService, Notifier, ServerService } from '@app/core'
+import { FormReactive, UserService } from '../../../shared'
+import { I18n } from '@ngx-translate/i18n-polyfill'
+import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service'
+import { UserValidatorsService } from '@app/shared/forms/form-validators/user-validators.service'
+import { User } from '../../../../../../shared'
+import { switchMap, tap } from 'rxjs/operators'
+
+@Component({
+ selector: 'my-account-change-email',
+ templateUrl: './my-account-change-email.component.html',
+ styleUrls: [ './my-account-change-email.component.scss' ]
+})
+export class MyAccountChangeEmailComponent extends FormReactive implements OnInit {
+ error: string = null
+ success: string = null
+ user: User = null
+
+ constructor (
+ protected formValidatorService: FormValidatorService,
+ private userValidatorsService: UserValidatorsService,
+ private notifier: Notifier,
+ private authService: AuthService,
+ private userService: UserService,
+ private serverService: ServerService,
+ private i18n: I18n
+ ) {
+ super()
+ }
+
+ ngOnInit () {
+ this.buildForm({
+ 'new-email': this.userValidatorsService.USER_EMAIL,
+ 'password': this.userValidatorsService.USER_PASSWORD
+ })
+
+ this.user = this.authService.getUser()
+ }
+
+ changeEmail () {
+ this.error = null
+ this.success = null
+
+ const password = this.form.value[ 'password' ]
+ const email = this.form.value[ 'new-email' ]
+
+ this.userService.changeEmail(password, email)
+ .pipe(
+ tap(() => this.authService.refreshUserInformation())
+ )
+ .subscribe(
+ () => {
+ this.form.reset()
+
+ if (this.serverService.getConfig().signup.requiresEmailVerification) {
+ this.success = this.i18n('Please check your emails to verify your new email.')
+ } else {
+ this.success = this.i18n('Email updated.')
+ }
+ },
+
+ err => {
+ if (err.status === 401) {
+ this.error = this.i18n('You current password is invalid.')
+ return
+ }
+
+ this.error = err.message
+ }
+ )
+ }
+}
diff --git a/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.html b/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.html
index ae797d1bc..a39061ee3 100644
--- a/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.html
+++ b/client/src/app/+my-account/my-account-settings/my-account-change-password/my-account-change-password.component.html
@@ -2,7 +2,7 @@