mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-03 17:59:37 +02:00
Refactor email enabled function
This commit is contained in:
parent
45f1bd72a0
commit
4c1c170934
11 changed files with 37 additions and 47 deletions
|
@ -3,7 +3,7 @@ import { UserRole } from '../../../shared'
|
|||
import { CONSTRAINTS_FIELDS, NSFW_POLICY_TYPES } from '../../initializers/constants'
|
||||
import { exists, isArray, isBooleanValid, isFileValid } from './misc'
|
||||
import { values } from 'lodash'
|
||||
import { CONFIG } from '../../initializers/config'
|
||||
import { isEmailEnabled } from '../../initializers/config'
|
||||
|
||||
const USERS_CONSTRAINTS_FIELDS = CONSTRAINTS_FIELDS.USERS
|
||||
|
||||
|
@ -13,9 +13,8 @@ function isUserPasswordValid (value: string) {
|
|||
|
||||
function isUserPasswordValidOrEmpty (value: string) {
|
||||
// Empty password is only possible if emailing is enabled.
|
||||
if (value === '') {
|
||||
return !!CONFIG.SMTP.HOSTNAME && !!CONFIG.SMTP.PORT
|
||||
}
|
||||
if (value === '') return isEmailEnabled()
|
||||
|
||||
return isUserPasswordValid(value)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue