aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--client/src/app/core/server/server.service.ts3
-rw-r--r--client/src/app/login/login.component.html7
-rw-r--r--client/src/app/login/login.component.ts9
-rw-r--r--server/controllers/api/config.ts4
-rw-r--r--server/lib/emailer.ts7
-rw-r--r--shared/models/server/server-config.model.ts4
6 files changed, 28 insertions, 6 deletions
diff --git a/client/src/app/core/server/server.service.ts b/client/src/app/core/server/server.service.ts
index da8bd26db..6eccb8336 100644
--- a/client/src/app/core/server/server.service.ts
+++ b/client/src/app/core/server/server.service.ts
@@ -37,6 +37,9 @@ export class ServerService {
37 css: '' 37 css: ''
38 } 38 }
39 }, 39 },
40 email: {
41 enabled: false
42 },
40 serverVersion: 'Unknown', 43 serverVersion: 'Unknown',
41 signup: { 44 signup: {
42 allowed: false, 45 allowed: false,
diff --git a/client/src/app/login/login.component.html b/client/src/app/login/login.component.html
index 93dbed525..9b8146624 100644
--- a/client/src/app/login/login.component.html
+++ b/client/src/app/login/login.component.html
@@ -59,7 +59,12 @@
59 </div> 59 </div>
60 60
61 <div class="modal-body"> 61 <div class="modal-body">
62 <div class="form-group"> 62
63 <div *ngIf="isEmailDisabled()" class="alert alert-danger" i18n>
64 We are sorry, you cannot recover you password because your instance administrator did not configure the PeerTube email system.
65 </div>
66
67 <div class="form-group" [hidden]="isEmailDisabled()">
63 <label i18n for="forgot-password-email">Email</label> 68 <label i18n for="forgot-password-email">Email</label>
64 <input 69 <input
65 type="email" id="forgot-password-email" i18n-placeholder placeholder="Email address" required 70 type="email" id="forgot-password-email" i18n-placeholder placeholder="Email address" required
diff --git a/client/src/app/login/login.component.ts b/client/src/app/login/login.component.ts
index 7553e6456..212a8ff1f 100644
--- a/client/src/app/login/login.component.ts
+++ b/client/src/app/login/login.component.ts
@@ -19,7 +19,6 @@ import { Router } from '@angular/router'
19export class LoginComponent extends FormReactive implements OnInit { 19export class LoginComponent extends FormReactive implements OnInit {
20 @ViewChild('emailInput') input: ElementRef 20 @ViewChild('emailInput') input: ElementRef
21 @ViewChild('forgotPasswordModal') forgotPasswordModal: ElementRef 21 @ViewChild('forgotPasswordModal') forgotPasswordModal: ElementRef
22 @ViewChild('forgotPasswordEmailInput') forgotPasswordEmailInput: ElementRef
23 22
24 error: string = null 23 error: string = null
25 forgotPasswordEmail = '' 24 forgotPasswordEmail = ''
@@ -45,6 +44,10 @@ export class LoginComponent extends FormReactive implements OnInit {
45 return this.serverService.getConfig().signup.allowed === true 44 return this.serverService.getConfig().signup.allowed === true
46 } 45 }
47 46
47 isEmailDisabled () {
48 return this.serverService.getConfig().email.enabled === false
49 }
50
48 ngOnInit () { 51 ngOnInit () {
49 this.buildForm({ 52 this.buildForm({
50 username: this.loginValidatorsService.LOGIN_USERNAME, 53 username: this.loginValidatorsService.LOGIN_USERNAME,
@@ -96,10 +99,6 @@ export class LoginComponent extends FormReactive implements OnInit {
96 ) 99 )
97 } 100 }
98 101
99 onForgotPasswordModalShown () {
100 this.forgotPasswordEmailInput.nativeElement.focus()
101 }
102
103 openForgotPasswordModal () { 102 openForgotPasswordModal () {
104 this.openedForgotPasswordModal = this.modalService.open(this.forgotPasswordModal) 103 this.openedForgotPasswordModal = this.modalService.open(this.forgotPasswordModal)
105 } 104 }
diff --git a/server/controllers/api/config.ts b/server/controllers/api/config.ts
index 5233e9f68..d65e321e9 100644
--- a/server/controllers/api/config.ts
+++ b/server/controllers/api/config.ts
@@ -11,6 +11,7 @@ import { ClientHtml } from '../../lib/client-html'
11import { auditLoggerFactory, CustomConfigAuditView, getAuditIdFromRes } from '../../helpers/audit-logger' 11import { auditLoggerFactory, CustomConfigAuditView, getAuditIdFromRes } from '../../helpers/audit-logger'
12import { remove, writeJSON } from 'fs-extra' 12import { remove, writeJSON } from 'fs-extra'
13import { getServerCommit } from '../../helpers/utils' 13import { getServerCommit } from '../../helpers/utils'
14import { Emailer } from '../../lib/emailer'
14 15
15const packageJSON = require('../../../../package.json') 16const packageJSON = require('../../../../package.json')
16const configRouter = express.Router() 17const configRouter = express.Router()
@@ -61,6 +62,9 @@ async function getConfig (req: express.Request, res: express.Response) {
61 css: CONFIG.INSTANCE.CUSTOMIZATIONS.CSS 62 css: CONFIG.INSTANCE.CUSTOMIZATIONS.CSS
62 } 63 }
63 }, 64 },
65 email: {
66 enabled: Emailer.Instance.isEnabled()
67 },
64 serverVersion: packageJSON.version, 68 serverVersion: packageJSON.version,
65 serverCommit, 69 serverCommit,
66 signup: { 70 signup: {
diff --git a/server/lib/emailer.ts b/server/lib/emailer.ts
index 9327792fb..074d4ad44 100644
--- a/server/lib/emailer.ts
+++ b/server/lib/emailer.ts
@@ -14,6 +14,7 @@ class Emailer {
14 private static instance: Emailer 14 private static instance: Emailer
15 private initialized = false 15 private initialized = false
16 private transporter: Transporter 16 private transporter: Transporter
17 private enabled = false
17 18
18 private constructor () {} 19 private constructor () {}
19 20
@@ -50,6 +51,8 @@ class Emailer {
50 tls, 51 tls,
51 auth 52 auth
52 }) 53 })
54
55 this.enabled = true
53 } else { 56 } else {
54 if (!isTestInstance()) { 57 if (!isTestInstance()) {
55 logger.error('Cannot use SMTP server because of lack of configuration. PeerTube will not be able to send mails!') 58 logger.error('Cannot use SMTP server because of lack of configuration. PeerTube will not be able to send mails!')
@@ -57,6 +60,10 @@ class Emailer {
57 } 60 }
58 } 61 }
59 62
63 isEnabled () {
64 return this.enabled
65 }
66
60 async checkConnectionOrDie () { 67 async checkConnectionOrDie () {
61 if (!this.transporter) return 68 if (!this.transporter) return
62 69
diff --git a/shared/models/server/server-config.model.ts b/shared/models/server/server-config.model.ts
index 91196c1eb..a6d28e05e 100644
--- a/shared/models/server/server-config.model.ts
+++ b/shared/models/server/server-config.model.ts
@@ -15,6 +15,10 @@ export interface ServerConfig {
15 } 15 }
16 } 16 }
17 17
18 email: {
19 enabled: boolean
20 }
21
18 signup: { 22 signup: {
19 allowed: boolean, 23 allowed: boolean,
20 allowedForCurrentIP: boolean, 24 allowedForCurrentIP: boolean,