From 2b084d7048a2d8a571d601916bdd21cef3a36311 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 28 Mar 2018 18:22:59 +0200 Subject: [PATCH] Add link to register in login form --- client/src/app/login/login.component.html | 27 ++++++++++++++---- client/src/app/login/login.component.scss | 19 +++++++++---- client/src/app/login/login.component.ts | 28 +++++++++++-------- .../src/app/shared/misc/help.component.html | 4 +-- 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 @@
- - +
+ + + + + + + +
+
{{ formErrors.username }}
@@ -21,7 +36,7 @@
I forgot my password
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 @@ @import '_variables'; @import '_mixins'; +label { + display: block; +} + input:not([type=submit]) { @include peertube-input-text(340px); - display: block; + display: inline-block; + margin-right: 5px; + } input[type=submit] { @@ -11,12 +17,13 @@ input[type=submit] { @include orange-button; } -input[type=password] { - display: inline-block; - margin-right: 5px; -} - .forgot-password-button { display: inline-block; cursor: pointer; } + +.create-an-account { + @include disable-default-a-behaviour; + + color: #000; +} 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 @@ import { Component, ElementRef, OnInit, ViewChild } from '@angular/core' import { FormBuilder, FormGroup, Validators } from '@angular/forms' import { Router } from '@angular/router' +import { RedirectService, ServerService } from '@app/core' import { UserService } from '@app/shared' import { NotificationsService } from 'angular2-notifications' import { ModalDirective } from 'ngx-bootstrap/modal' @@ -34,16 +35,20 @@ export class LoginComponent extends FormReactive implements OnInit { } forgotPasswordEmail = '' - constructor ( - private authService: AuthService, - private userService: UserService, - private notificationsService: NotificationsService, - private formBuilder: FormBuilder, - private router: Router - ) { + constructor (private authService: AuthService, + private userService: UserService, + private serverService: ServerService, + private redirectService: RedirectService, + private notificationsService: NotificationsService, + private formBuilder: FormBuilder, + private router: Router) { super() } + get signupAllowed () { + return this.serverService.getConfig().signup.allowed === true + } + buildForm () { this.form = this.formBuilder.group({ username: [ '', Validators.required ], @@ -62,11 +67,12 @@ export class LoginComponent extends FormReactive implements OnInit { const { username, password } = this.form.value - this.authService.login(username, password).subscribe( - () => this.router.navigate(['/videos/list']), + this.authService.login(username, password) + .subscribe( + () => this.redirectService.redirectToHomepage(), - err => this.error = err.message - ) + err => this.error = err.message + ) } 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 @@ - +> -- 2.25.1