diff --git a/client/src/app/+signup/+register/register-step-user.component.html b/client/src/app/+signup/+register/register-step-user.component.html
index 55fc097d0..6eab4df0c 100644
--- a/client/src/app/+signup/+register/register-step-user.component.html
+++ b/client/src/app/+signup/+register/register-step-user.component.html
@@ -54,10 +54,10 @@
Password
-
+
{{ formErrors.password }}
diff --git a/client/src/app/+videos/+video-edit/shared/video-edit.component.html b/client/src/app/+videos/+video-edit/shared/video-edit.component.html
index f62464d35..4747cec27 100644
--- a/client/src/app/+videos/+video-edit/shared/video-edit.component.html
+++ b/client/src/app/+videos/+video-edit/shared/video-edit.component.html
@@ -213,12 +213,12 @@
Live RTMP Url
-
+
diff --git a/client/src/app/shared/form-validators/user-validators.ts b/client/src/app/shared/form-validators/user-validators.ts
index 9efc5180d..115930146 100644
--- a/client/src/app/shared/form-validators/user-validators.ts
+++ b/client/src/app/shared/form-validators/user-validators.ts
@@ -39,6 +39,15 @@ export const USER_EMAIL_VALIDATOR: BuildFormValidator = {
}
}
+export const USER_EXISTING_PASSWORD_VALIDATOR: BuildFormValidator = {
+ VALIDATORS: [
+ Validators.required
+ ],
+ MESSAGES: {
+ 'required': $localize`Password is required.`
+ }
+}
+
export const USER_PASSWORD_VALIDATOR: BuildFormValidator = {
VALIDATORS: [
Validators.required,
diff --git a/client/src/app/shared/shared-forms/dynamic-form-field.component.html b/client/src/app/shared/shared-forms/dynamic-form-field.component.html
index 6a3c31637..658d8ce5b 100644
--- a/client/src/app/shared/shared-forms/dynamic-form-field.component.html
+++ b/client/src/app/shared/shared-forms/dynamic-form-field.component.html
@@ -5,7 +5,7 @@
-
+
diff --git a/client/src/app/shared/shared-forms/index.ts b/client/src/app/shared/shared-forms/index.ts
index 66b426191..1d859b991 100644
--- a/client/src/app/shared/shared-forms/index.ts
+++ b/client/src/app/shared/shared-forms/index.ts
@@ -1,7 +1,7 @@
export * from './form-validator.service'
export * from './form-reactive'
export * from './select'
-export * from './input-readonly-copy.component'
+export * from './input-toggle-hidden.component'
export * from './input-switch.component'
export * from './markdown-textarea.component'
export * from './peertube-checkbox.component'
diff --git a/client/src/app/shared/shared-forms/input-readonly-copy.component.html b/client/src/app/shared/shared-forms/input-readonly-copy.component.html
deleted file mode 100644
index 7a75bd70b..000000000
--- a/client/src/app/shared/shared-forms/input-readonly-copy.component.html
+++ /dev/null
@@ -1,9 +0,0 @@
-
diff --git a/client/src/app/shared/shared-forms/input-readonly-copy.component.scss b/client/src/app/shared/shared-forms/input-readonly-copy.component.scss
deleted file mode 100644
index 8dc4f113c..000000000
--- a/client/src/app/shared/shared-forms/input-readonly-copy.component.scss
+++ /dev/null
@@ -1,3 +0,0 @@
-input.readonly {
- font-size: 15px;
-}
diff --git a/client/src/app/shared/shared-forms/input-readonly-copy.component.ts b/client/src/app/shared/shared-forms/input-readonly-copy.component.ts
deleted file mode 100644
index b04d69d05..000000000
--- a/client/src/app/shared/shared-forms/input-readonly-copy.component.ts
+++ /dev/null
@@ -1,18 +0,0 @@
-import { Component, Input } from '@angular/core'
-import { Notifier } from '@app/core'
-
-@Component({
- selector: 'my-input-readonly-copy',
- templateUrl: './input-readonly-copy.component.html',
- styleUrls: [ './input-readonly-copy.component.scss' ]
-})
-export class InputReadonlyCopyComponent {
- @Input() id: string
- @Input() value = ''
-
- constructor (private notifier: Notifier) { }
-
- activateCopiedMessage () {
- this.notifier.success($localize`Copied`)
- }
-}
diff --git a/client/src/app/shared/shared-forms/input-toggle-hidden.component.html b/client/src/app/shared/shared-forms/input-toggle-hidden.component.html
new file mode 100644
index 000000000..f59dc6215
--- /dev/null
+++ b/client/src/app/shared/shared-forms/input-toggle-hidden.component.html
@@ -0,0 +1,13 @@
+
diff --git a/client/src/app/shared/shared-forms/input-toggle-hidden.component.scss b/client/src/app/shared/shared-forms/input-toggle-hidden.component.scss
new file mode 100644
index 000000000..e20f69b86
--- /dev/null
+++ b/client/src/app/shared/shared-forms/input-toggle-hidden.component.scss
@@ -0,0 +1,11 @@
+@import '_variables';
+@import '_mixins';
+
+input {
+ @include peertube-input-text(auto);
+
+ // set again properties of peertube-input-text that are overriden by .input-group
+ font-size: 15px !important;
+ padding-left: 15px !important;
+ padding-right: 15px !important;
+}
diff --git a/client/src/app/shared/shared-forms/input-toggle-hidden.component.ts b/client/src/app/shared/shared-forms/input-toggle-hidden.component.ts
new file mode 100644
index 000000000..0e974426b
--- /dev/null
+++ b/client/src/app/shared/shared-forms/input-toggle-hidden.component.ts
@@ -0,0 +1,66 @@
+import { Component, forwardRef, Input } from '@angular/core'
+import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'
+import { Notifier } from '@app/core'
+
+@Component({
+ selector: 'my-input-toggle-hidden',
+ templateUrl: './input-toggle-hidden.component.html',
+ styleUrls: [ './input-toggle-hidden.component.scss' ],
+ providers: [
+ {
+ provide: NG_VALUE_ACCESSOR,
+ useExisting: forwardRef(() => InputToggleHiddenComponent),
+ multi: true
+ }
+ ]
+})
+export class InputToggleHiddenComponent implements ControlValueAccessor {
+ @Input() id = Math.random().toString(11).slice(2, 8) // id cannot be left empty or undefined
+ @Input() value = ''
+ @Input() autocomplete = 'off'
+ @Input() placeholder = ''
+ @Input() withToggle = true
+ @Input() withCopy = false
+ @Input() readonly = false
+ @Input() show = false
+
+ constructor (private notifier: Notifier) { }
+
+ get inputType () {
+ return this.show
+ ? 'text'
+ : 'password'
+ }
+
+ get toggleTitle () {
+ return this.show
+ ? $localize`Hide`
+ : $localize`Show`
+ }
+
+ toggle () {
+ this.show = !this.show
+ }
+
+ activateCopiedMessage () {
+ this.notifier.success($localize`Copied`)
+ }
+
+ propagateChange = (_: any) => { /* empty */ }
+
+ writeValue (value: string) {
+ this.value = value
+ }
+
+ registerOnChange (fn: (_: any) => void) {
+ this.propagateChange = fn
+ }
+
+ registerOnTouched () {
+ // Unused
+ }
+
+ update () {
+ this.propagateChange(this.value)
+ }
+}
diff --git a/client/src/app/shared/shared-forms/shared-form.module.ts b/client/src/app/shared/shared-forms/shared-form.module.ts
index 060abc995..22e8dd05a 100644
--- a/client/src/app/shared/shared-forms/shared-form.module.ts
+++ b/client/src/app/shared/shared-forms/shared-form.module.ts
@@ -7,7 +7,7 @@ import { SharedGlobalIconModule } from '../shared-icons'
import { SharedMainModule } from '../shared-main/shared-main.module'
import { DynamicFormFieldComponent } from './dynamic-form-field.component'
import { FormValidatorService } from './form-validator.service'
-import { InputReadonlyCopyComponent } from './input-readonly-copy.component'
+import { InputToggleHiddenComponent } from './input-toggle-hidden.component'
import { InputSwitchComponent } from './input-switch.component'
import { MarkdownTextareaComponent } from './markdown-textarea.component'
import { PeertubeCheckboxComponent } from './peertube-checkbox.component'
@@ -30,7 +30,7 @@ import { TimestampInputComponent } from './timestamp-input.component'
],
declarations: [
- InputReadonlyCopyComponent,
+ InputToggleHiddenComponent,
MarkdownTextareaComponent,
PeertubeCheckboxComponent,
PreviewUploadComponent,
@@ -55,7 +55,7 @@ import { TimestampInputComponent } from './timestamp-input.component'
InputMaskModule,
NgSelectModule,
- InputReadonlyCopyComponent,
+ InputToggleHiddenComponent,
MarkdownTextareaComponent,
PeertubeCheckboxComponent,
PreviewUploadComponent,
diff --git a/client/src/app/shared/shared-share-modal/video-share.component.html b/client/src/app/shared/shared-share-modal/video-share.component.html
index 80b4e446a..bcb1db4c4 100644
--- a/client/src/app/shared/shared-share-modal/video-share.component.html
+++ b/client/src/app/shared/shared-share-modal/video-share.component.html
@@ -18,7 +18,7 @@
-
+
@@ -38,7 +38,7 @@
-
+
The url is not secured (no HTTPS), so the embed video won't work on HTTPS websites (web browsers block non secured HTTP requests on HTTPS websites).
@@ -72,7 +72,7 @@
-
+
@@ -92,7 +92,7 @@
-
+
The url is not secured (no HTTPS), so the embed video won't work on HTTPS websites (web browsers block non secured HTTP requests on HTTPS websites).
diff --git a/client/src/app/shared/shared-share-modal/video-share.component.scss b/client/src/app/shared/shared-share-modal/video-share.component.scss
index 091d4dc3b..e4d3aacff 100644
--- a/client/src/app/shared/shared-share-modal/video-share.component.scss
+++ b/client/src/app/shared/shared-share-modal/video-share.component.scss
@@ -1,7 +1,7 @@
@import '_mixins';
@import '_variables';
-my-input-readonly-copy {
+my-input-toggle-hidden {
width: 100%;
}
diff --git a/client/src/app/shared/shared-video-live/live-stream-information.component.html b/client/src/app/shared/shared-video-live/live-stream-information.component.html
index 6693c1af2..8d9467fe5 100644
--- a/client/src/app/shared/shared-video-live/live-stream-information.component.html
+++ b/client/src/app/shared/shared-video-live/live-stream-information.component.html
@@ -13,12 +13,12 @@
Live RTMP Url
-
+
diff --git a/client/src/sass/application.scss b/client/src/sass/application.scss
index ece8411af..3f6e6c8a7 100644
--- a/client/src/sass/application.scss
+++ b/client/src/sass/application.scss
@@ -120,7 +120,8 @@ code {
margin-top: 5px;
}
-.input-error {
+.input-error
+my-input-toggle-hidden ::ng-deep input {
border-color: $red !important;
}