diff --git a/helpers/publishHelpers.js b/helpers/publishHelpers.js index d218c844..329f6787 100644 --- a/helpers/publishHelpers.js +++ b/helpers/publishHelpers.js @@ -70,11 +70,6 @@ module.exports = { throw new Error('The claim name you provided is not allowed. Only the following characters are allowed: A-Z, a-z, 0-9, and "-"'); } }, - validateLicense (license) { - if ((license.indexOf('Public Domain') === -1) && (license.indexOf('Creative Commons') === -1)) { - throw new Error('Only posts with a "Public Domain" or "Creative Commons" license are eligible for publishing through spee.ch'); - } - }, cleanseChannelName (channelName) { if (!channelName) { return null; @@ -84,15 +79,6 @@ module.exports = { } return channelName; }, - cleanseUserName (userName) { - if (!userName) { - return null; - } - if (userName.indexOf('@') !== -1) { - userName = userName.substring(userName.indexOf('@')); - } - return userName; - }, createPublishParams (filePath, name, title, description, license, nsfw, thumbnail, channelName) { logger.debug(`Creating Publish Parameters`); // provide defaults for title diff --git a/routes/api-routes.js b/routes/api-routes.js index 03f35454..95bf222b 100644 --- a/routes/api-routes.js +++ b/routes/api-routes.js @@ -5,7 +5,7 @@ const multipartMiddleware = multipart({uploadDir: config.files.uploadDirectory}) const db = require('../models'); const { publish } = require('../controllers/publishController.js'); const { getClaimList, resolveUri, getClaim } = require('../helpers/lbryApi.js'); -const { createPublishParams, validateApiPublishRequest, validatePublishSubmission, cleanseChannelName, cleanseUserName, checkClaimNameAvailability, checkChannelAvailability } = require('../helpers/publishHelpers.js'); +const { createPublishParams, validateApiPublishRequest, validatePublishSubmission, cleanseChannelName, checkClaimNameAvailability, checkChannelAvailability } = require('../helpers/publishHelpers.js'); const errorHandlers = require('../helpers/errorHandlers.js'); const { authenticateOrSkip } = require('../auth/authentication.js'); @@ -234,44 +234,4 @@ module.exports = (app) => { errorHandlers.handleApiError(originalUrl, ip, error, res); }); }); - app.put('/api/password', ({ body, ip, originalUrl }, res) => { - let userName; - let { channelName, oldPassword, newPassword } = body; - // validate all necessary params were provided - if (!channelName || !oldPassword || !newPassword) { - res.status(400).json({success: false, message: 'provide channelName, oldPassword, and newPassword'}); - } - // cleanse channel name - userName = cleanseUserName(channelName); - // validate password and respond - db - .User - .findOne({where: {userName: userName}}) - .then(user => { - if (!user) { - return res.status(401).json({success: false, message: 'Incorrect username or password.'}); - } - return user.comparePassword(oldPassword, (passwordErr, isMatch) => { - if (passwordErr) { - throw passwordErr; - } - if (!isMatch) { - return res.status(401).json({success: false, message: 'Incorrect username or password.'}); - } - logger.debug('Password was a match, updating password'); - return user - .changePassword(newPassword) - .then(() => { - logger.debug('Password successfully updated'); - res.status(200).json({success: true, message: 'password successfully changed'}); - }) - .catch(error => { - throw error; - }); - }); - }) - .catch(error => { - errorHandlers.handleApiError('password reset', originalUrl, ip, error, res); - }); - }); };