Merge branch 'master' into docs-website-link

This commit is contained in:
Alexandre BODIN 2019-11-28 09:00:11 +01:00 committed by GitHub
commit 0cc737145e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 60 additions and 17 deletions

View File

@ -80,6 +80,12 @@ $navbar-horizontal-padding = 1.5rem
.navbar
padding $navbar-vertical-padding $navbar-horizontal-padding
line-height $navbarHeight - 1.4rem
.deprecated
padding 0 0.5rem
margin-left 1rem
font-weight 600
background-color #fff3cd
border-radius .25rem
a, span, img
display inline-block
.logo

View File

@ -97,6 +97,12 @@ strapi(/* {...} */).start();
If you want to host the administration on another server than the API, [please take a look at this dedicated section](../admin-panel/deploy.md).
## Docker
In this section, you will not find a specific guide to deploy your app with [Docker](https://www.docker.com/).
We recently updated the [strapi/strapi-docker](https://github.com/strapi/strapi-docker) GitHub repository that contains all informations needed to user Strapi with Docker.
## Amazon AWS
This is a step-by-step guide for deploying a Strapi project to [Amazon AWS EC2](https://aws.amazon.com/ec2/). This guide will connect to an [Amazon AWS RDS](https://aws.amazon.com/rds/) for managing and hosting the database. Optionally, this guide will show you how to connect host and serve images on [Amazon AWS S3](https://aws.amazon.com/s3/). Prior to starting this guide, you should have created a [Strapi project](../getting-started/quick-start.md), to use for deploying on AWS.
@ -995,7 +1001,7 @@ npm install pm2@latest -g
### The ecosystem.config.js file
- You will need to configure an `ecosystem.config.js` file. This file will manage the **database connection variables** Strapi needs to connect to your database. The `ecosystem.config.js` will also be used by `pm2` to restart your project whenever any changes are made to files within the Strapi file system itself (such as when an update arrives from GitHub). You can read more about this file [here](https://pm2.io/doc/en/runtime/guide/development-tools/).
- You will need to configure an `ecosystem.config.js` file. This file will manage the **database connection variables** Strapi needs to connect to your database. The `ecosystem.config.js` will also be used by `pm2` to restart your project whenever any changes are made to files within the Strapi file system itself (such as when an update arrives from GitHub). You can read more about this file [here](https://pm2.keymetrics.io/docs/usage/pm2-doc-single-page/).
- You will need to open your `nano` editor and then `copy/paste` the following:

View File

@ -272,7 +272,22 @@ module.exports = {
},
async forgotPassword(ctx) {
const { email } = ctx.request.body;
let { email } = ctx.request.body;
// Check if the provided email is valid or not.
const isEmail = emailRegExp.test(email);
if (isEmail) {
email = email.toLowerCase();
} else {
return ctx.badRequest(
null,
formatError({
id: 'Auth.form.error.email.format',
message: 'Please provide valid email address.',
})
);
}
const pluginStore = await strapi.store({
environment: '',
@ -620,7 +635,7 @@ module.exports = {
}
const user = await strapi.query('user', 'users-permissions').findOne({
email: params.email
email: params.email,
});
if (user.confirmed) {
@ -635,22 +650,38 @@ module.exports = {
_.pick(user.toJSON ? user.toJSON() : user, ['id'])
);
const settings = await pluginStore.get({ key: 'email' }).then(storeEmail => {
try {
return storeEmail['email_confirmation'].options;
} catch (err) {
return {};
}
});
const settings = await pluginStore
.get({ key: 'email' })
.then(storeEmail => {
try {
return storeEmail['email_confirmation'].options;
} catch (err) {
return {};
}
});
settings.message = await strapi.plugins['users-permissions'].services.userspermissions.template(settings.message, {
settings.message = await strapi.plugins[
'users-permissions'
].services.userspermissions.template(settings.message, {
URL: new URL('/auth/email-confirmation', strapi.config.url).toString(),
USER: _.omit(user.toJSON ? user.toJSON() : user, ['password', 'resetPasswordToken', 'role', 'provider']),
CODE: jwt
USER: _.omit(user.toJSON ? user.toJSON() : user, [
'password',
'resetPasswordToken',
'role',
'provider',
]),
CODE: jwt,
});
settings.object = await strapi.plugins['users-permissions'].services.userspermissions.template(settings.object, {
USER: _.omit(user.toJSON ? user.toJSON() : user, ['password', 'resetPasswordToken', 'role', 'provider']),
settings.object = await strapi.plugins[
'users-permissions'
].services.userspermissions.template(settings.object, {
USER: _.omit(user.toJSON ? user.toJSON() : user, [
'password',
'resetPasswordToken',
'role',
'provider',
]),
});
try {
@ -663,11 +694,11 @@ module.exports = {
replyTo: settings.response_email,
subject: settings.object,
text: settings.message,
html: settings.message
html: settings.message,
});
ctx.send({
email: (user.toJSON ? user.toJSON() : user).email,
sent: true
sent: true,
});
} catch (err) {
return ctx.badRequest(null, err);