aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-10-29 11:16:36 +0200
committerChocobozzz <me@florianbigard.com>2021-10-29 11:16:36 +0200
commitbd898dd76babf6ab33a0040297bfb40a69a69dda (patch)
tree6d972d754bafe6b79a7f8d08ad26783ef2489f3e
parentdb581cf7b99eb60d2e6d9bee5c020ef22b0a1a41 (diff)
downloadPeerTube-bd898dd76babf6ab33a0040297bfb40a69a69dda.tar.gz
PeerTube-bd898dd76babf6ab33a0040297bfb40a69a69dda.tar.zst
PeerTube-bd898dd76babf6ab33a0040297bfb40a69a69dda.zip
Add message if registration is disabled
-rw-r--r--client/src/app/+signup/+register/register.component.html102
-rw-r--r--client/src/app/+signup/+register/register.component.scss4
-rw-r--r--client/src/app/+signup/+register/register.component.ts7
3 files changed, 65 insertions, 48 deletions
diff --git a/client/src/app/+signup/+register/register.component.html b/client/src/app/+signup/+register/register.component.html
index de72065d3..b51f08a4c 100644
--- a/client/src/app/+signup/+register/register.component.html
+++ b/client/src/app/+signup/+register/register.component.html
@@ -1,56 +1,62 @@
1<div class="margin-content"> 1<div class="margin-content">
2 2
3 <div i18n class="title-page title-page-single"> 3 <div class="signup-disabled" *ngIf="signupDisabled">
4 Create an account 4 <div class="alert alert-warning" i18n>Signup is not enabled on this instance.</div>
5 </div> 5 </div>
6 6
7 <my-signup-success *ngIf="signupDone" [message]="success"></my-signup-success> 7 <ng-container *ngIf="!signupDisabled">
8 <div *ngIf="info" class="alert alert-info">{{ info }}</div> 8 <div i18n class="title-page title-page-single">
9 9 Create an account
10 <div class="wrapper" [hidden]="signupDone"> 10 </div>
11 <div class="register-form">
12 <my-custom-stepper linear *ngIf="!signupDone">
13 <cdk-step [stepControl]="formStepTerms" i18n-label="Stepper label for the registration page describing terms of service" label="Terms">
14 <div class="instance-information">
15 <my-instance-about-accordion (init)="onInstanceAboutAccordionInit($event)" [panels]="instanceInformationPanels"></my-instance-about-accordion>
16 </div>
17
18 <my-register-step-terms
19 [hasCodeOfConduct]="!!aboutHtml.codeOfConduct"
20 [minimumAge]="minimumAge"
21 (formBuilt)="onTermsFormBuilt($event)" (termsClick)="onTermsClick()" (codeOfConductClick)="onCodeOfConductClick()"
22 ></my-register-step-terms>
23
24 <button cdkStepperNext [disabled]="!formStepTerms || !formStepTerms.valid">{{ defaultNextStepButtonLabel }}</button>
25 </cdk-step>
26
27 <cdk-step [stepControl]="formStepUser" i18n-label="Stepper label for the registration page asking user informations" label="User">
28 <my-register-step-user (formBuilt)="onUserFormBuilt($event)" [videoUploadDisabled]="videoUploadDisabled"></my-register-step-user>
29
30 <button cdkStepperPrevious>{{ defaultPreviousStepButtonLabel }}</button>
31 <button cdkStepperNext [disabled]="!formStepUser || !formStepUser.valid" (click)="videoUploadDisabled && signup()">{{ stepUserButtonLabel }}</button>
32 </cdk-step>
33
34 <cdk-step [stepControl]="formStepChannel" i18n-label="Stepper label for the registration page asking information about the default channel" label="Channel" *ngIf="!videoUploadDisabled">
35 <my-register-step-channel (formBuilt)="onChannelFormBuilt($event)" [username]="getUsername()"></my-register-step-channel>
36
37 <button cdkStepperPrevious>{{ defaultPreviousStepButtonLabel }}</button>
38 <button cdkStepperNext [disabled]="!formStepChannel || !formStepChannel.valid || hasSameChannelAndAccountNames()" (click)="signup()" i18n>
39 Create my account
40 </button>
41 </cdk-step>
42
43 <cdk-step i18n-label label="Done" editable="false">
44 <div *ngIf="!signupDone && !error" class="done-loader">
45 <my-loader [loading]="true"></my-loader>
46
47 <div i18n>PeerTube is creating your account...</div>
48 </div>
49 11
50 <div *ngIf="error" class="alert alert-danger">{{ error }}</div> 12 <my-signup-success *ngIf="signupDone" [message]="success"></my-signup-success>
51 </cdk-step> 13 <div *ngIf="info" class="alert alert-info">{{ info }}</div>
52 </my-custom-stepper> 14
15 <div class="wrapper" [hidden]="signupDone">
16 <div class="register-form">
17 <my-custom-stepper linear *ngIf="!signupDone">
18 <cdk-step [stepControl]="formStepTerms" i18n-label="Stepper label for the registration page describing terms of service" label="Terms">
19 <div class="instance-information">
20 <my-instance-about-accordion (init)="onInstanceAboutAccordionInit($event)" [panels]="instanceInformationPanels"></my-instance-about-accordion>
21 </div>
22
23 <my-register-step-terms
24 [hasCodeOfConduct]="!!aboutHtml.codeOfConduct"
25 [minimumAge]="minimumAge"
26 (formBuilt)="onTermsFormBuilt($event)" (termsClick)="onTermsClick()" (codeOfConductClick)="onCodeOfConductClick()"
27 ></my-register-step-terms>
28
29 <button cdkStepperNext [disabled]="!formStepTerms || !formStepTerms.valid">{{ defaultNextStepButtonLabel }}</button>
30 </cdk-step>
31
32 <cdk-step [stepControl]="formStepUser" i18n-label="Stepper label for the registration page asking user informations" label="User">
33 <my-register-step-user (formBuilt)="onUserFormBuilt($event)" [videoUploadDisabled]="videoUploadDisabled"></my-register-step-user>
34
35 <button cdkStepperPrevious>{{ defaultPreviousStepButtonLabel }}</button>
36 <button cdkStepperNext [disabled]="!formStepUser || !formStepUser.valid" (click)="videoUploadDisabled && signup()">{{ stepUserButtonLabel }}</button>
37 </cdk-step>
38
39 <cdk-step [stepControl]="formStepChannel" i18n-label="Stepper label for the registration page asking information about the default channel" label="Channel" *ngIf="!videoUploadDisabled">
40 <my-register-step-channel (formBuilt)="onChannelFormBuilt($event)" [username]="getUsername()"></my-register-step-channel>
41
42 <button cdkStepperPrevious>{{ defaultPreviousStepButtonLabel }}</button>
43 <button cdkStepperNext [disabled]="!formStepChannel || !formStepChannel.valid || hasSameChannelAndAccountNames()" (click)="signup()" i18n>
44 Create my account
45 </button>
46 </cdk-step>
47
48 <cdk-step i18n-label label="Done" editable="false">
49 <div *ngIf="!signupDone && !error" class="done-loader">
50 <my-loader [loading]="true"></my-loader>
51
52 <div i18n>PeerTube is creating your account...</div>
53 </div>
54
55 <div *ngIf="error" class="alert alert-danger">{{ error }}</div>
56 </cdk-step>
57 </my-custom-stepper>
58 </div>
53 </div> 59 </div>
54 </div> 60 </ng-container>
55 61
56</div> 62</div>
diff --git a/client/src/app/+signup/+register/register.component.scss b/client/src/app/+signup/+register/register.component.scss
index fc7ddb0e9..e3ef95609 100644
--- a/client/src/app/+signup/+register/register.component.scss
+++ b/client/src/app/+signup/+register/register.component.scss
@@ -6,6 +6,10 @@
6 text-align: center; 6 text-align: center;
7} 7}
8 8
9.signup-disabled {
10 padding-top: 30vh;
11}
12
9.wrapper { 13.wrapper {
10 display: flex; 14 display: flex;
11 flex-direction: column; 15 flex-direction: column;
diff --git a/client/src/app/+signup/+register/register.component.ts b/client/src/app/+signup/+register/register.component.ts
index d8ac39c7c..bb7276459 100644
--- a/client/src/app/+signup/+register/register.component.ts
+++ b/client/src/app/+signup/+register/register.component.ts
@@ -42,6 +42,8 @@ export class RegisterComponent implements OnInit {
42 defaultNextStepButtonLabel = $localize`:Button on the registration form to go to the previous step:Next` 42 defaultNextStepButtonLabel = $localize`:Button on the registration form to go to the previous step:Next`
43 stepUserButtonLabel = this.defaultNextStepButtonLabel 43 stepUserButtonLabel = this.defaultNextStepButtonLabel
44 44
45 signupDisabled = false
46
45 private serverConfig: ServerConfig 47 private serverConfig: ServerConfig
46 48
47 constructor ( 49 constructor (
@@ -62,6 +64,11 @@ export class RegisterComponent implements OnInit {
62 ngOnInit (): void { 64 ngOnInit (): void {
63 this.serverConfig = this.route.snapshot.data.serverConfig 65 this.serverConfig = this.route.snapshot.data.serverConfig
64 66
67 if (this.serverConfig.signup.allowed === false || this.serverConfig.signup.allowedForCurrentIP === false) {
68 this.signupDisabled = true
69 return
70 }
71
65 this.videoUploadDisabled = this.serverConfig.user.videoQuota === 0 72 this.videoUploadDisabled = this.serverConfig.user.videoQuota === 0
66 this.stepUserButtonLabel = this.videoUploadDisabled 73 this.stepUserButtonLabel = this.videoUploadDisabled
67 ? $localize`:Button on the registration form to finalize the account and channel creation:Signup` 74 ? $localize`:Button on the registration form to finalize the account and channel creation:Signup`