mirror of
https://github.com/strapi/strapi.git
synced 2025-11-08 22:32:02 +00:00
Fix conflict
This commit is contained in:
commit
2e1283f117
12
.github/ISSUE_TEMPLATE.md
vendored
12
.github/ISSUE_TEMPLATE.md
vendored
@ -1,4 +1,16 @@
|
|||||||
**Node.js version**:
|
**Node.js version**:
|
||||||
|
|
||||||
**npm version**:
|
**npm version**:
|
||||||
|
|
||||||
**Strapi version**:
|
**Strapi version**:
|
||||||
|
|
||||||
**Operating system**:
|
**Operating system**:
|
||||||
|
|
||||||
|
|
||||||
|
**Do you want to request a *feature* or report a *bug*?**
|
||||||
|
|
||||||
|
**What is the current behavior?**
|
||||||
|
|
||||||
|
**If the current behavior is a bug, please provide the steps to reproduce the problem**
|
||||||
|
|
||||||
|
**What is the expected behavior?**
|
||||||
|
|||||||
@ -8,8 +8,8 @@
|
|||||||
"host": "${process.env.DATABASE_HOST || 'localhost'}",
|
"host": "${process.env.DATABASE_HOST || 'localhost'}",
|
||||||
"port": "${process.env.DATABASE_PORT || 27017}",
|
"port": "${process.env.DATABASE_PORT || 27017}",
|
||||||
"database": "${process.env.DATABASE_NAME || 'production'}",
|
"database": "${process.env.DATABASE_NAME || 'production'}",
|
||||||
"username": "",
|
"username": "${process.env.DATABASE_USERNAME || ''}",
|
||||||
"password": ""
|
"password": "${process.env.DATABASE_PASSWORD || ''}"
|
||||||
},
|
},
|
||||||
"options": {}
|
"options": {}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,6 +15,7 @@ const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPl
|
|||||||
const LodashModuleReplacementPlugin = require('lodash-webpack-plugin');
|
const LodashModuleReplacementPlugin = require('lodash-webpack-plugin');
|
||||||
|
|
||||||
const isAdmin = process.env.IS_ADMIN === 'true';
|
const isAdmin = process.env.IS_ADMIN === 'true';
|
||||||
|
const isSetup = path.resolve(process.env.PWD, '..', '..') === path.resolve(process.env.INIT_CWD);
|
||||||
const appPath = (() => {
|
const appPath = (() => {
|
||||||
if (process.env.APP_PATH) {
|
if (process.env.APP_PATH) {
|
||||||
return process.env.APP_PATH;
|
return process.env.APP_PATH;
|
||||||
@ -22,7 +23,13 @@ const appPath = (() => {
|
|||||||
|
|
||||||
return isAdmin ? path.resolve(process.env.PWD, '..') : path.resolve(process.env.PWD, '..', '..');
|
return isAdmin ? path.resolve(process.env.PWD, '..') : path.resolve(process.env.PWD, '..', '..');
|
||||||
})();
|
})();
|
||||||
const isSetup = path.resolve(process.env.PWD, '..', '..') === path.resolve(process.env.INIT_CWD);
|
|
||||||
|
const rootAdminpath = (() => {
|
||||||
|
if (isSetup) {
|
||||||
|
return isAdmin ? path.resolve(appPath, 'strapi-admin') : path.resolve(appPath, 'packages', 'strapi-admin');
|
||||||
|
}
|
||||||
|
return path.resolve(appPath, 'admin');
|
||||||
|
})();
|
||||||
|
|
||||||
// Load plugins into the same build in development mode.
|
// Load plugins into the same build in development mode.
|
||||||
const plugins = {
|
const plugins = {
|
||||||
|
|||||||
@ -43,11 +43,14 @@ module.exports = function (strapi) {
|
|||||||
const { host, port, username, password, database } = _.defaults(connection.settings, strapi.config.hook.settings.mongoose);
|
const { host, port, username, password, database } = _.defaults(connection.settings, strapi.config.hook.settings.mongoose);
|
||||||
|
|
||||||
// Connect to mongo database
|
// Connect to mongo database
|
||||||
if (_.isEmpty(username) || _.isEmpty(password)) {
|
const connectOptions = {}
|
||||||
instance.connect(`mongodb://${host}:${port}/${database}`);
|
if (!_.isEmpty(username)) {
|
||||||
} else {
|
connectOptions.user = username
|
||||||
instance.connect(`mongodb://${username}:${password}@${host}:${port}/${database}`);
|
if (!_.isEmpty(password)) {
|
||||||
|
connectOptions.pass = password
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
instance.connect(`mongodb://${host}:${port}/${database}`, connectOptions);
|
||||||
|
|
||||||
// Handle error
|
// Handle error
|
||||||
instance.connection.on('error', error => {
|
instance.connection.on('error', error => {
|
||||||
|
|||||||
@ -9,8 +9,16 @@ const logger = require('strapi-utils').logger;
|
|||||||
|
|
||||||
module.exports = (scope, success, error) => {
|
module.exports = (scope, success, error) => {
|
||||||
const Mongoose = require(path.resolve(`${scope.rootPath}/node_modules/mongoose`));
|
const Mongoose = require(path.resolve(`${scope.rootPath}/node_modules/mongoose`));
|
||||||
|
|
||||||
Mongoose.connect(`mongodb://${ (scope.database.settings.username && scope.database.settings.password) ? `${scope.database.settings.username}:${scope.database.settings.password}@` : '' }${scope.database.settings.host}:${scope.database.settings.port}/${scope.database.settings.database}`, function (err) {
|
const { username, password } = scope.database.settings
|
||||||
|
const connectOptions = {}
|
||||||
|
if (username) {
|
||||||
|
connectOptions.user = username
|
||||||
|
if (password) {
|
||||||
|
connectOptions.pass = password
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Mongoose.connect(`mongodb://${scope.database.settings.host}:${scope.database.settings.port}/${scope.database.settings.database}`, connectOptions, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
logger.warn('Database connection has failed! Make sure your database is running.');
|
logger.warn('Database connection has failed! Make sure your database is running.');
|
||||||
return error();
|
return error();
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
const _ = require('lodash');
|
const _ = require('lodash');
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
const Grant = require('grant-koa');
|
const emailRegExp = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
callback: async (ctx) => {
|
callback: async (ctx) => {
|
||||||
@ -33,11 +33,11 @@ module.exports = {
|
|||||||
const query = {};
|
const query = {};
|
||||||
|
|
||||||
// Check if the provided identifier is an email or not.
|
// Check if the provided identifier is an email or not.
|
||||||
const isEmail = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(params.identifier);
|
const isEmail = emailRegExp.test(params.identifier);
|
||||||
|
|
||||||
// Set the identifier to the appropriate query field.
|
// Set the identifier to the appropriate query field.
|
||||||
if (isEmail) {
|
if (isEmail) {
|
||||||
query.email = params.identifier;
|
query.email = params.identifier.toLowerCase();
|
||||||
} else {
|
} else {
|
||||||
query.username = params.identifier;
|
query.username = params.identifier;
|
||||||
}
|
}
|
||||||
@ -207,6 +207,11 @@ module.exports = {
|
|||||||
params.role = '1';
|
params.role = '1';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if the provided identifier is an email or not.
|
||||||
|
const isEmail = emailRegExp.test(params.identifier);
|
||||||
|
if (isEmail) {
|
||||||
|
params.identifier = params.identifier.toLowerCase();
|
||||||
|
}
|
||||||
params.password = await strapi.plugins['users-permissions'].services.user.hashPassword(params);
|
params.password = await strapi.plugins['users-permissions'].services.user.hashPassword(params);
|
||||||
|
|
||||||
const user = await strapi.query('user', 'users-permissions').findOne({
|
const user = await strapi.query('user', 'users-permissions').findOne({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user