mirror of https://github.com/Chocobozzz/PeerTube
Add link to register in login form
parent
5afdd0a52f
commit
2b084d7048
|
@ -7,11 +7,26 @@
|
||||||
|
|
||||||
<form role="form" (ngSubmit)="login()" [formGroup]="form">
|
<form role="form" (ngSubmit)="login()" [formGroup]="form">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="username">User</label>
|
<div>
|
||||||
<input
|
<label for="username">User</label>
|
||||||
type="text" id="username" placeholder="Username or email address" required
|
<input
|
||||||
formControlName="username" [ngClass]="{ 'input-error': formErrors['username'] }"
|
type="text" id="username" placeholder="Username or email address" required tabindex="1"
|
||||||
>
|
formControlName="username" [ngClass]="{ 'input-error': formErrors['username'] }"
|
||||||
|
>
|
||||||
|
<a *ngIf="signupAllowed === true" routerLink="/signup" class="create-an-account">
|
||||||
|
or create an account
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a *ngIf="signupAllowed === false" href="https://joinpeertube.org/en/#getting-started" target="_blank" class="create-an-account">
|
||||||
|
or create an account on another instance
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<my-help
|
||||||
|
*ngIf="signupAllowed === false" helpType="custom"
|
||||||
|
customHtml="User registration is not allowed on this instance, but you can register on many others!"
|
||||||
|
></my-help>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div *ngIf="formErrors.username" class="form-error">
|
<div *ngIf="formErrors.username" class="form-error">
|
||||||
{{ formErrors.username }}
|
{{ formErrors.username }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -21,7 +36,7 @@
|
||||||
<label for="password">Password</label>
|
<label for="password">Password</label>
|
||||||
<div>
|
<div>
|
||||||
<input
|
<input
|
||||||
type="password" name="password" id="password" placeholder="Password" required
|
type="password" name="password" id="password" placeholder="Password" required tabindex="2"
|
||||||
formControlName="password" [ngClass]="{ 'input-error': formErrors['password'] }"
|
formControlName="password" [ngClass]="{ 'input-error': formErrors['password'] }"
|
||||||
>
|
>
|
||||||
<div class="forgot-password-button" (click)="openForgotPasswordModal()">I forgot my password</div>
|
<div class="forgot-password-button" (click)="openForgotPasswordModal()">I forgot my password</div>
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
@import '_variables';
|
@import '_variables';
|
||||||
@import '_mixins';
|
@import '_mixins';
|
||||||
|
|
||||||
|
label {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
input:not([type=submit]) {
|
input:not([type=submit]) {
|
||||||
@include peertube-input-text(340px);
|
@include peertube-input-text(340px);
|
||||||
display: block;
|
display: inline-block;
|
||||||
|
margin-right: 5px;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=submit] {
|
input[type=submit] {
|
||||||
|
@ -11,12 +17,13 @@ input[type=submit] {
|
||||||
@include orange-button;
|
@include orange-button;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=password] {
|
|
||||||
display: inline-block;
|
|
||||||
margin-right: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.forgot-password-button {
|
.forgot-password-button {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.create-an-account {
|
||||||
|
@include disable-default-a-behaviour;
|
||||||
|
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'
|
import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'
|
||||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms'
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms'
|
||||||
import { Router } from '@angular/router'
|
import { Router } from '@angular/router'
|
||||||
|
import { RedirectService, ServerService } from '@app/core'
|
||||||
import { UserService } from '@app/shared'
|
import { UserService } from '@app/shared'
|
||||||
import { NotificationsService } from 'angular2-notifications'
|
import { NotificationsService } from 'angular2-notifications'
|
||||||
import { ModalDirective } from 'ngx-bootstrap/modal'
|
import { ModalDirective } from 'ngx-bootstrap/modal'
|
||||||
|
@ -34,16 +35,20 @@ export class LoginComponent extends FormReactive implements OnInit {
|
||||||
}
|
}
|
||||||
forgotPasswordEmail = ''
|
forgotPasswordEmail = ''
|
||||||
|
|
||||||
constructor (
|
constructor (private authService: AuthService,
|
||||||
private authService: AuthService,
|
private userService: UserService,
|
||||||
private userService: UserService,
|
private serverService: ServerService,
|
||||||
private notificationsService: NotificationsService,
|
private redirectService: RedirectService,
|
||||||
private formBuilder: FormBuilder,
|
private notificationsService: NotificationsService,
|
||||||
private router: Router
|
private formBuilder: FormBuilder,
|
||||||
) {
|
private router: Router) {
|
||||||
super()
|
super()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get signupAllowed () {
|
||||||
|
return this.serverService.getConfig().signup.allowed === true
|
||||||
|
}
|
||||||
|
|
||||||
buildForm () {
|
buildForm () {
|
||||||
this.form = this.formBuilder.group({
|
this.form = this.formBuilder.group({
|
||||||
username: [ '', Validators.required ],
|
username: [ '', Validators.required ],
|
||||||
|
@ -62,11 +67,12 @@ export class LoginComponent extends FormReactive implements OnInit {
|
||||||
|
|
||||||
const { username, password } = this.form.value
|
const { username, password } = this.form.value
|
||||||
|
|
||||||
this.authService.login(username, password).subscribe(
|
this.authService.login(username, password)
|
||||||
() => this.router.navigate(['/videos/list']),
|
.subscribe(
|
||||||
|
() => this.redirectService.redirectToHomepage(),
|
||||||
|
|
||||||
err => this.error = err.message
|
err => this.error = err.message
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
askResetPassword () {
|
askResetPassword () {
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|
||||||
<button
|
<span
|
||||||
class="help-tooltip-button" containerClass="help-tooltip" title="Click to get help"
|
class="help-tooltip-button" containerClass="help-tooltip" title="Click to get help"
|
||||||
#tooltipDirective="bs-tooltip" [tooltip]="tooltipTemplate" triggers="click"
|
#tooltipDirective="bs-tooltip" [tooltip]="tooltipTemplate" triggers="click"
|
||||||
></button>
|
></span>
|
||||||
|
|
Loading…
Reference in New Issue