diff options
Diffstat (limited to 'client/src/app/signup')
-rw-r--r-- | client/src/app/signup/index.ts | 3 | ||||
-rw-r--r-- | client/src/app/signup/signup-routing.module.ts | 27 | ||||
-rw-r--r-- | client/src/app/signup/signup.component.html | 72 | ||||
-rw-r--r-- | client/src/app/signup/signup.component.scss | 39 | ||||
-rw-r--r-- | client/src/app/signup/signup.component.ts | 78 | ||||
-rw-r--r-- | client/src/app/signup/signup.module.ts | 24 |
6 files changed, 0 insertions, 243 deletions
diff --git a/client/src/app/signup/index.ts b/client/src/app/signup/index.ts deleted file mode 100644 index b0aca9723..000000000 --- a/client/src/app/signup/index.ts +++ /dev/null | |||
@@ -1,3 +0,0 @@ | |||
1 | export * from './signup-routing.module' | ||
2 | export * from './signup.component' | ||
3 | export * from './signup.module' | ||
diff --git a/client/src/app/signup/signup-routing.module.ts b/client/src/app/signup/signup-routing.module.ts deleted file mode 100644 index 820d16d4d..000000000 --- a/client/src/app/signup/signup-routing.module.ts +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | import { NgModule } from '@angular/core' | ||
2 | import { RouterModule, Routes } from '@angular/router' | ||
3 | import { MetaGuard } from '@ngx-meta/core' | ||
4 | import { SignupComponent } from './signup.component' | ||
5 | import { ServerConfigResolver } from '@app/core/routing/server-config-resolver.service' | ||
6 | |||
7 | const signupRoutes: Routes = [ | ||
8 | { | ||
9 | path: 'signup', | ||
10 | component: SignupComponent, | ||
11 | canActivate: [ MetaGuard ], | ||
12 | data: { | ||
13 | meta: { | ||
14 | title: 'Signup' | ||
15 | } | ||
16 | }, | ||
17 | resolve: { | ||
18 | serverConfigLoaded: ServerConfigResolver | ||
19 | } | ||
20 | } | ||
21 | ] | ||
22 | |||
23 | @NgModule({ | ||
24 | imports: [ RouterModule.forChild(signupRoutes) ], | ||
25 | exports: [ RouterModule ] | ||
26 | }) | ||
27 | export class SignupRoutingModule {} | ||
diff --git a/client/src/app/signup/signup.component.html b/client/src/app/signup/signup.component.html deleted file mode 100644 index 07d24b381..000000000 --- a/client/src/app/signup/signup.component.html +++ /dev/null | |||
@@ -1,72 +0,0 @@ | |||
1 | <div class="margin-content"> | ||
2 | |||
3 | <div i18n class="title-page title-page-single"> | ||
4 | Create an account | ||
5 | </div> | ||
6 | |||
7 | <div *ngIf="info" class="alert alert-info">{{ info }}</div> | ||
8 | <div *ngIf="error" class="alert alert-danger">{{ error }}</div> | ||
9 | |||
10 | <div class="d-flex justify-content-left flex-wrap"> | ||
11 | <form role="form" (ngSubmit)="signup()" [formGroup]="form"> | ||
12 | <div class="form-group"> | ||
13 | <label for="username" i18n>Username</label> | ||
14 | |||
15 | <div class="input-group"> | ||
16 | <input | ||
17 | type="text" id="username" i18n-placeholder placeholder="Example: jane_doe" | ||
18 | formControlName="username" [ngClass]="{ 'input-error': formErrors['username'] }" | ||
19 | > | ||
20 | <div class="input-group-append"> | ||
21 | <span class="input-group-text">@{{ instanceHost }}</span> | ||
22 | </div> | ||
23 | </div> | ||
24 | |||
25 | <div *ngIf="formErrors.username" class="form-error"> | ||
26 | {{ formErrors.username }} | ||
27 | </div> | ||
28 | </div> | ||
29 | |||
30 | <div class="form-group"> | ||
31 | <label for="email" i18n>Email</label> | ||
32 | <input | ||
33 | type="text" id="email" i18n-placeholder placeholder="Email" | ||
34 | formControlName="email" [ngClass]="{ 'input-error': formErrors['email'] }" | ||
35 | > | ||
36 | <div *ngIf="formErrors.email" class="form-error"> | ||
37 | {{ formErrors.email }} | ||
38 | </div> | ||
39 | </div> | ||
40 | |||
41 | <div class="form-group"> | ||
42 | <label for="password" i18n>Password</label> | ||
43 | <input | ||
44 | type="password" id="password" i18n-placeholder placeholder="Password" | ||
45 | formControlName="password" [ngClass]="{ 'input-error': formErrors['password'] }" | ||
46 | > | ||
47 | <div *ngIf="formErrors.password" class="form-error"> | ||
48 | {{ formErrors.password }} | ||
49 | </div> | ||
50 | </div> | ||
51 | |||
52 | <div class="form-group form-group-terms"> | ||
53 | <my-peertube-checkbox | ||
54 | inputName="terms" formControlName="terms" | ||
55 | i18n-labelHtml labelHtml="I am at least 16 years old and agree to the <a href='/about/instance#terms-section' target='_blank'rel='noopener noreferrer'>Terms</a> of this instance" | ||
56 | ></my-peertube-checkbox> | ||
57 | |||
58 | <div *ngIf="formErrors.terms" class="form-error"> | ||
59 | {{ formErrors.terms }} | ||
60 | </div> | ||
61 | </div> | ||
62 | |||
63 | <input type="submit" i18n-value value="Signup" [disabled]="!form.valid || signupDone"> | ||
64 | </form> | ||
65 | |||
66 | <div> | ||
67 | <label i18n>Features found on this instance</label> | ||
68 | <my-instance-features-table></my-instance-features-table> | ||
69 | </div> | ||
70 | </div> | ||
71 | |||
72 | </div> | ||
diff --git a/client/src/app/signup/signup.component.scss b/client/src/app/signup/signup.component.scss deleted file mode 100644 index 90e1e8e74..000000000 --- a/client/src/app/signup/signup.component.scss +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | @import '_variables'; | ||
2 | @import '_mixins'; | ||
3 | |||
4 | my-instance-features-table { | ||
5 | display: block; | ||
6 | |||
7 | margin-bottom: 40px; | ||
8 | } | ||
9 | |||
10 | form { | ||
11 | margin: 0 60px 40px 0; | ||
12 | } | ||
13 | |||
14 | .form-group-terms { | ||
15 | margin: 30px 0; | ||
16 | } | ||
17 | |||
18 | .input-group { | ||
19 | @include peertube-input-group(400px); | ||
20 | } | ||
21 | |||
22 | .input-group-append { | ||
23 | height: 30px; | ||
24 | } | ||
25 | |||
26 | input:not([type=submit]) { | ||
27 | @include peertube-input-text(400px); | ||
28 | display: block; | ||
29 | |||
30 | &#username { | ||
31 | width: auto; | ||
32 | flex-grow: 1; | ||
33 | } | ||
34 | } | ||
35 | |||
36 | input[type=submit] { | ||
37 | @include peertube-button; | ||
38 | @include orange-button; | ||
39 | } | ||
diff --git a/client/src/app/signup/signup.component.ts b/client/src/app/signup/signup.component.ts deleted file mode 100644 index 13941ec79..000000000 --- a/client/src/app/signup/signup.component.ts +++ /dev/null | |||
@@ -1,78 +0,0 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | ||
2 | import { AuthService, Notifier, RedirectService, ServerService } from '@app/core' | ||
3 | import { UserCreate } from '../../../../shared' | ||
4 | import { FormReactive, UserService, UserValidatorsService } from '../shared' | ||
5 | import { I18n } from '@ngx-translate/i18n-polyfill' | ||
6 | import { FormValidatorService } from '@app/shared/forms/form-validators/form-validator.service' | ||
7 | |||
8 | @Component({ | ||
9 | selector: 'my-signup', | ||
10 | templateUrl: './signup.component.html', | ||
11 | styleUrls: [ './signup.component.scss' ] | ||
12 | }) | ||
13 | export class SignupComponent extends FormReactive implements OnInit { | ||
14 | info: string = null | ||
15 | error: string = null | ||
16 | signupDone = false | ||
17 | |||
18 | constructor ( | ||
19 | protected formValidatorService: FormValidatorService, | ||
20 | private authService: AuthService, | ||
21 | private userValidatorsService: UserValidatorsService, | ||
22 | private notifier: Notifier, | ||
23 | private userService: UserService, | ||
24 | private serverService: ServerService, | ||
25 | private redirectService: RedirectService, | ||
26 | private i18n: I18n | ||
27 | ) { | ||
28 | super() | ||
29 | } | ||
30 | |||
31 | get instanceHost () { | ||
32 | return window.location.host | ||
33 | } | ||
34 | |||
35 | get requiresEmailVerification () { | ||
36 | return this.serverService.getConfig().signup.requiresEmailVerification | ||
37 | } | ||
38 | |||
39 | ngOnInit () { | ||
40 | this.buildForm({ | ||
41 | username: this.userValidatorsService.USER_USERNAME, | ||
42 | password: this.userValidatorsService.USER_PASSWORD, | ||
43 | email: this.userValidatorsService.USER_EMAIL, | ||
44 | terms: this.userValidatorsService.USER_TERMS | ||
45 | }) | ||
46 | } | ||
47 | |||
48 | signup () { | ||
49 | this.error = null | ||
50 | |||
51 | const userCreate: UserCreate = this.form.value | ||
52 | |||
53 | this.userService.signup(userCreate).subscribe( | ||
54 | () => { | ||
55 | this.signupDone = true | ||
56 | |||
57 | if (this.requiresEmailVerification) { | ||
58 | this.info = this.i18n('Welcome! Now please check your emails to verify your account and complete signup.') | ||
59 | return | ||
60 | } | ||
61 | |||
62 | // Auto login | ||
63 | this.authService.login(userCreate.username, userCreate.password) | ||
64 | .subscribe( | ||
65 | () => { | ||
66 | this.notifier.success(this.i18n('You are now logged in as {{username}}!', { username: userCreate.username })) | ||
67 | |||
68 | this.redirectService.redirectToHomepage() | ||
69 | }, | ||
70 | |||
71 | err => this.error = err.message | ||
72 | ) | ||
73 | }, | ||
74 | |||
75 | err => this.error = err.message | ||
76 | ) | ||
77 | } | ||
78 | } | ||
diff --git a/client/src/app/signup/signup.module.ts b/client/src/app/signup/signup.module.ts deleted file mode 100644 index 61560ddcf..000000000 --- a/client/src/app/signup/signup.module.ts +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | import { NgModule } from '@angular/core' | ||
2 | |||
3 | import { SignupRoutingModule } from './signup-routing.module' | ||
4 | import { SignupComponent } from './signup.component' | ||
5 | import { SharedModule } from '../shared' | ||
6 | |||
7 | @NgModule({ | ||
8 | imports: [ | ||
9 | SignupRoutingModule, | ||
10 | SharedModule | ||
11 | ], | ||
12 | |||
13 | declarations: [ | ||
14 | SignupComponent | ||
15 | ], | ||
16 | |||
17 | exports: [ | ||
18 | SignupComponent | ||
19 | ], | ||
20 | |||
21 | providers: [ | ||
22 | ] | ||
23 | }) | ||
24 | export class SignupModule { } | ||