add username information in profile settings

pull/3589/head
Rigel Kent 2021-01-17 18:13:05 +01:00
parent 111e6c1807
commit 52a3f561f5
No known key found for this signature in database
GPG Key ID: 5E53E96A494E452F
4 changed files with 28 additions and 1 deletions

View File

@ -2,7 +2,8 @@
<div *ngIf="success" class="alert alert-success">{{ success }}</div>
<div i18n class="current-email">
Your current email is <span class="email">{{ user.email }}</span>
Your current email is <span class="email">{{ user.email }}</span>.
It is never shown to the public.
</div>
<div i18n class="pending-email" *ngIf="user.pendingEmail">

View File

@ -2,6 +2,17 @@
<form role="form" (ngSubmit)="updateMyProfile()" [formGroup]="form">
<div class="form-group">
<label i18n for="user-name">User name</label>
<input
type="text" id="user-name" class="form-control"
formControlName="user-name"
>
<div class="text-muted" i18n>
People can find you @{{ user.username }}@{{ instanceHost }}
</div>
</div>
<div class="form-group">
<label i18n for="display-name">Display name</label>
<input

View File

@ -16,6 +16,14 @@ input[type=text] {
display: block;
}
input#user-name {
border: none;
& + div {
padding-left: 15px;
}
}
input[type=submit] {
@include peertube-button;
@include orange-button;

View File

@ -25,18 +25,25 @@ export class MyAccountProfileComponent extends FormReactive implements OnInit {
ngOnInit () {
this.buildForm({
'user-name': null,
'display-name': USER_DISPLAY_NAME_REQUIRED_VALIDATOR,
description: USER_DESCRIPTION_VALIDATOR
})
this.form.controls['user-name'].disable()
this.userInformationLoaded.subscribe(() => {
this.form.patchValue({
'user-name': this.user.username,
'display-name': this.user.account.displayName,
description: this.user.account.description
})
})
}
get instanceHost () {
return window.location.host
}
updateMyProfile () {
const displayName = this.form.value['display-name']
const description = this.form.value['description'] || null