Move mail related settings to new mail route
there is quite a bit of circular dep between settings, platform and mail code. this will be removed in future commits.
This commit is contained in:
14
src/user.js
14
src/user.js
@@ -36,10 +36,10 @@ var assert = require('assert'),
|
||||
groups = require('./groups.js'),
|
||||
GroupError = groups.GroupError,
|
||||
hat = require('hat'),
|
||||
mail = require('./mail.js'),
|
||||
mailer = require('./mailer.js'),
|
||||
mailboxdb = require('./mailboxdb.js'),
|
||||
safe = require('safetydance'),
|
||||
settings = require('./settings.js'),
|
||||
tokendb = require('./tokendb.js'),
|
||||
userdb = require('./userdb.js'),
|
||||
util = require('util'),
|
||||
@@ -178,7 +178,7 @@ function createUser(username, password, email, displayName, auditSource, options
|
||||
if (error && error.reason === DatabaseError.ALREADY_EXISTS) return callback(new UserError(UserError.ALREADY_EXISTS, error.message));
|
||||
if (error) return callback(new UserError(UserError.INTERNAL_ERROR, error));
|
||||
|
||||
settings.getMailConfig(function (error, mailConfig) {
|
||||
mail.getMailConfig(function (error, mailConfig) {
|
||||
if (error) return callback(new UserError(UserError.INTERNAL_ERROR, error));
|
||||
|
||||
if (mailConfig.enabled) {
|
||||
@@ -259,7 +259,7 @@ function verifyWithEmail(email, password, callback) {
|
||||
|
||||
email = email.toLowerCase();
|
||||
|
||||
settings.getMailConfig(function (error, mailConfig) {
|
||||
mail.getMailConfig(function (error, mailConfig) {
|
||||
if (error) return callback(new UserError(UserError.INTERNAL_ERROR, error));
|
||||
|
||||
if (mailConfig.enabled) return verifyWithUsername(email.split('@')[0], password, callback);
|
||||
@@ -302,7 +302,7 @@ function listUsers(callback) {
|
||||
userdb.getAllWithGroupIds(function (error, results) {
|
||||
if (error) return callback(new UserError(UserError.INTERNAL_ERROR, error));
|
||||
|
||||
settings.getMailConfig(function (error, mailConfig) {
|
||||
mail.getMailConfig(function (error, mailConfig) {
|
||||
if (error) return callback(new UserError(UserError.INTERNAL_ERROR, error));
|
||||
|
||||
results.forEach(function (result) {
|
||||
@@ -345,7 +345,7 @@ function getUser(userId, callback) {
|
||||
result.groupIds = groupIds;
|
||||
result.admin = groupIds.indexOf(constants.ADMIN_GROUP_ID) !== -1;
|
||||
|
||||
settings.getMailConfig(function (error, mailConfig) {
|
||||
mail.getMailConfig(function (error, mailConfig) {
|
||||
if (error) return callback(new UserError(UserError.INTERNAL_ERROR, error));
|
||||
|
||||
if (mailConfig.enabled) {
|
||||
@@ -451,7 +451,7 @@ function getAllAdmins(callback) {
|
||||
userdb.getAllAdmins(function (error, admins) {
|
||||
if (error) return callback(new UserError(UserError.INTERNAL_ERROR, error));
|
||||
|
||||
settings.getMailConfig(function (error, mailConfig) {
|
||||
mail.getMailConfig(function (error, mailConfig) {
|
||||
if (error) return callback(new UserError(UserError.INTERNAL_ERROR, error));
|
||||
|
||||
admins.forEach(function (admin) {
|
||||
@@ -575,7 +575,7 @@ function getOwner(callback) {
|
||||
if (error && error.reason === DatabaseError.NOT_FOUND) return callback(new UserError(UserError.NOT_FOUND));
|
||||
if (error) return callback(new UserError(UserError.INTERNAL_ERROR, error));
|
||||
|
||||
settings.getMailConfig(function (error, mailConfig) {
|
||||
mail.getMailConfig(function (error, mailConfig) {
|
||||
if (error) return callback(new UserError(UserError.INTERNAL_ERROR, error));
|
||||
|
||||
if (mailConfig.enabled) {
|
||||
|
||||
Reference in New Issue
Block a user