disable signup when closedRegistration
This commit is contained in:
parent
815149a2cd
commit
845a0a3b01
1 changed files with 5 additions and 1 deletions
|
@ -2,6 +2,7 @@ const PassportLocalStrategy = require('passport-local').Strategy;
|
||||||
const { createChannel } = require('../../lbrynet');
|
const { createChannel } = require('../../lbrynet');
|
||||||
const logger = require('winston');
|
const logger = require('winston');
|
||||||
const db = require('../../models');
|
const db = require('../../models');
|
||||||
|
const { publishing: { closedRegistration } } = require('@config/siteConfig');
|
||||||
|
|
||||||
module.exports = new PassportLocalStrategy(
|
module.exports = new PassportLocalStrategy(
|
||||||
{
|
{
|
||||||
|
@ -9,10 +10,13 @@ module.exports = new PassportLocalStrategy(
|
||||||
passwordField: 'password',
|
passwordField: 'password',
|
||||||
},
|
},
|
||||||
(username, password, done) => {
|
(username, password, done) => {
|
||||||
|
if (closedRegistration) {
|
||||||
|
return done('Registration is disabled');
|
||||||
|
}
|
||||||
|
|
||||||
logger.verbose(`new channel signup request. user: ${username} pass: ${password} .`);
|
logger.verbose(`new channel signup request. user: ${username} pass: ${password} .`);
|
||||||
let userInfo = {};
|
let userInfo = {};
|
||||||
// server-side validaton of inputs (username, password)
|
// server-side validaton of inputs (username, password)
|
||||||
|
|
||||||
// create the channel and retrieve the metadata
|
// create the channel and retrieve the metadata
|
||||||
return createChannel(`@${username}`)
|
return createChannel(`@${username}`)
|
||||||
.then(tx => {
|
.then(tx => {
|
||||||
|
|
Loading…
Reference in a new issue