aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/login/login.component.html27
-rw-r--r--client/src/app/login/login.component.scss19
-rw-r--r--client/src/app/login/login.component.ts28
-rw-r--r--client/src/app/shared/misc/help.component.html4
4 files changed, 53 insertions, 25 deletions
diff --git a/client/src/app/login/login.component.html b/client/src/app/login/login.component.html
index 660a08280..b7fd25d27 100644
--- a/client/src/app/login/login.component.html
+++ b/client/src/app/login/login.component.html
@@ -7,11 +7,26 @@
7 7
8 <form role="form" (ngSubmit)="login()" [formGroup]="form"> 8 <form role="form" (ngSubmit)="login()" [formGroup]="form">
9 <div class="form-group"> 9 <div class="form-group">
10 <label for="username">User</label> 10 <div>
11 <input 11 <label for="username">User</label>
12 type="text" id="username" placeholder="Username or email address" required 12 <input
13 formControlName="username" [ngClass]="{ 'input-error': formErrors['username'] }" 13 type="text" id="username" placeholder="Username or email address" required tabindex="1"
14 > 14 formControlName="username" [ngClass]="{ 'input-error': formErrors['username'] }"
15 >
16 <a *ngIf="signupAllowed === true" routerLink="/signup" class="create-an-account">
17 or create an account
18 </a>
19
20 <a *ngIf="signupAllowed === false" href="https://joinpeertube.org/en/#getting-started" target="_blank" class="create-an-account">
21 or create an account on another instance
22 </a>
23
24 <my-help
25 *ngIf="signupAllowed === false" helpType="custom"
26 customHtml="User registration is not allowed on this instance, but you can register on many others!"
27 ></my-help>
28 </div>
29
15 <div *ngIf="formErrors.username" class="form-error"> 30 <div *ngIf="formErrors.username" class="form-error">
16 {{ formErrors.username }} 31 {{ formErrors.username }}
17 </div> 32 </div>
@@ -21,7 +36,7 @@
21 <label for="password">Password</label> 36 <label for="password">Password</label>
22 <div> 37 <div>
23 <input 38 <input
24 type="password" name="password" id="password" placeholder="Password" required 39 type="password" name="password" id="password" placeholder="Password" required tabindex="2"
25 formControlName="password" [ngClass]="{ 'input-error': formErrors['password'] }" 40 formControlName="password" [ngClass]="{ 'input-error': formErrors['password'] }"
26 > 41 >
27 <div class="forgot-password-button" (click)="openForgotPasswordModal()">I forgot my password</div> 42 <div class="forgot-password-button" (click)="openForgotPasswordModal()">I forgot my password</div>
diff --git a/client/src/app/login/login.component.scss b/client/src/app/login/login.component.scss
index 2cf6991ce..4a37ee961 100644
--- a/client/src/app/login/login.component.scss
+++ b/client/src/app/login/login.component.scss
@@ -1,9 +1,15 @@
1@import '_variables'; 1@import '_variables';
2@import '_mixins'; 2@import '_mixins';
3 3
4label {
5 display: block;
6}
7
4input:not([type=submit]) { 8input:not([type=submit]) {
5 @include peertube-input-text(340px); 9 @include peertube-input-text(340px);
6 display: block; 10 display: inline-block;
11 margin-right: 5px;
12
7} 13}
8 14
9input[type=submit] { 15input[type=submit] {
@@ -11,12 +17,13 @@ input[type=submit] {
11 @include orange-button; 17 @include orange-button;
12} 18}
13 19
14input[type=password] {
15 display: inline-block;
16 margin-right: 5px;
17}
18
19.forgot-password-button { 20.forgot-password-button {
20 display: inline-block; 21 display: inline-block;
21 cursor: pointer; 22 cursor: pointer;
22} 23}
24
25.create-an-account {
26 @include disable-default-a-behaviour;
27
28 color: #000;
29}
diff --git a/client/src/app/login/login.component.ts b/client/src/app/login/login.component.ts
index 22e8c77dd..f7b49ec45 100644
--- a/client/src/app/login/login.component.ts
+++ b/client/src/app/login/login.component.ts
@@ -1,6 +1,7 @@
1import { Component, ElementRef, OnInit, ViewChild } from '@angular/core' 1import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'
2import { FormBuilder, FormGroup, Validators } from '@angular/forms' 2import { FormBuilder, FormGroup, Validators } from '@angular/forms'
3import { Router } from '@angular/router' 3import { Router } from '@angular/router'
4import { RedirectService, ServerService } from '@app/core'
4import { UserService } from '@app/shared' 5import { UserService } from '@app/shared'
5import { NotificationsService } from 'angular2-notifications' 6import { NotificationsService } from 'angular2-notifications'
6import { ModalDirective } from 'ngx-bootstrap/modal' 7import { ModalDirective } from 'ngx-bootstrap/modal'
@@ -34,16 +35,20 @@ export class LoginComponent extends FormReactive implements OnInit {
34 } 35 }
35 forgotPasswordEmail = '' 36 forgotPasswordEmail = ''
36 37
37 constructor ( 38 constructor (private authService: AuthService,
38 private authService: AuthService, 39 private userService: UserService,
39 private userService: UserService, 40 private serverService: ServerService,
40 private notificationsService: NotificationsService, 41 private redirectService: RedirectService,
41 private formBuilder: FormBuilder, 42 private notificationsService: NotificationsService,
42 private router: Router 43 private formBuilder: FormBuilder,
43 ) { 44 private router: Router) {
44 super() 45 super()
45 } 46 }
46 47
48 get signupAllowed () {
49 return this.serverService.getConfig().signup.allowed === true
50 }
51
47 buildForm () { 52 buildForm () {
48 this.form = this.formBuilder.group({ 53 this.form = this.formBuilder.group({
49 username: [ '', Validators.required ], 54 username: [ '', Validators.required ],
@@ -62,11 +67,12 @@ export class LoginComponent extends FormReactive implements OnInit {
62 67
63 const { username, password } = this.form.value 68 const { username, password } = this.form.value
64 69
65 this.authService.login(username, password).subscribe( 70 this.authService.login(username, password)
66 () => this.router.navigate(['/videos/list']), 71 .subscribe(
72 () => this.redirectService.redirectToHomepage(),
67 73
68 err => this.error = err.message 74 err => this.error = err.message
69 ) 75 )
70 } 76 }
71 77
72 askResetPassword () { 78 askResetPassword () {
diff --git a/client/src/app/shared/misc/help.component.html b/client/src/app/shared/misc/help.component.html
index bacbe9cdb..e37d93b62 100644
--- a/client/src/app/shared/misc/help.component.html
+++ b/client/src/app/shared/misc/help.component.html
@@ -12,7 +12,7 @@
12 </ng-template> 12 </ng-template>
13</ng-template> 13</ng-template>
14 14
15<button 15<span
16 class="help-tooltip-button" containerClass="help-tooltip" title="Click to get help" 16 class="help-tooltip-button" containerClass="help-tooltip" title="Click to get help"
17 #tooltipDirective="bs-tooltip" [tooltip]="tooltipTemplate" triggers="click" 17 #tooltipDirective="bs-tooltip" [tooltip]="tooltipTemplate" triggers="click"
18></button> 18></span>