mirror of
https://github.com/strapi/strapi.git
synced 2026-01-08 05:04:10 +00:00
Merge branch 'master' into master
This commit is contained in:
commit
7f2fbc8453
@ -156,3 +156,7 @@ $.ajax({
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
## Email templates
|
||||
|
||||
[See the documentation on GitHub](https://github.com/strapi/strapi/blob/master/packages/strapi-plugin-users-permissions/docs/email-templates.md)
|
||||
|
||||
@ -90,10 +90,9 @@ module.exports = {
|
||||
if (!name) return ctx.badRequest(null, [{ messages: [{ id: 'request.error.name.missing' }] }]);
|
||||
if (!_.includes(Service.getConnections(), connection)) return ctx.badRequest(null, [{ messages: [{ id: 'request.error.connection.unknow' }] }]);
|
||||
if (strapi.models[_.toLower(name)] && name !== model) return ctx.badRequest(null, [{ messages: [{ id: 'request.error.model.exist' }] }]);
|
||||
if (!strapi.models[_.toLower(model)]) return ctx.badRequest(null, [{ messages: [{ id: 'request.error.model.unknow' }] }]);
|
||||
if (!strapi.models[_.toLower(model)] && plugin && !strapi.plugins[_.toLower(plugin)].models[_.toLower(model)]) return ctx.badRequest(null, [{ messages: [{ id: 'request.error.model.unknow' }] }]);
|
||||
if (!_.isNaN(parseFloat(name[0]))) return ctx.badRequest(null, [{ messages: [{ id: 'request.error.model.name' }] }]);
|
||||
if (plugin && !strapi.plugins[_.toLower(plugin)]) return ctx.badRequest(null, [{ message: [{ id: 'request.error.plugin.name' }] }]);
|
||||
if (plugin && !strapi.plugins[_.toLower(plugin)].models[_.toLower(model)]) return ctx.badRequest(null, [{ message: [{ id: 'request.error.model.unknow' }] }]);
|
||||
|
||||
const [formatedAttributes, attributesErrors] = Service.formatAttributes(attributes, name.toLowerCase(), plugin);
|
||||
|
||||
|
||||
@ -7,9 +7,9 @@
|
||||
|
||||
.separator {
|
||||
box-sizing: border-box;
|
||||
height: 2px;
|
||||
height: 1px;
|
||||
width: 100%;
|
||||
margin-top: 1.3rem;
|
||||
margin-top: 1.4rem;
|
||||
margin-bottom: 2.1rem;
|
||||
border: 1px solid #F6F6F6;
|
||||
background: #F6F6F6;
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { map, size } from 'lodash';
|
||||
import { map, omitBy, size } from 'lodash';
|
||||
|
||||
// Design
|
||||
import Button from 'components/Button';
|
||||
@ -49,6 +49,8 @@ const generateListTitle = (data, settingType) => {
|
||||
};
|
||||
|
||||
function List({ data, deleteData, noButton, onButtonClick, settingType, values }) {
|
||||
const object = omitBy(data, (v) => v.name === 'server'); // Remove the server key when displaying providers
|
||||
|
||||
return (
|
||||
<div className={styles.list}>
|
||||
<div className={styles.flex}>
|
||||
@ -67,7 +69,7 @@ function List({ data, deleteData, noButton, onButtonClick, settingType, values }
|
||||
</div>
|
||||
<div className={styles.ulContainer}>
|
||||
<ul className={noButton ? styles.listPadded : ''}>
|
||||
{map(data, item => (
|
||||
{map(object, item => (
|
||||
<ListRow
|
||||
deleteData={deleteData}
|
||||
item={item}
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
color: #333740;
|
||||
font-family: Lato;
|
||||
font-size: 1.8rem;
|
||||
font-weight: 500;
|
||||
font-weight: 600;
|
||||
line-height: 2.2rem;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ import React from 'react';
|
||||
import cn from 'classnames';
|
||||
import PropTypes from 'prop-types';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { get, includes } from 'lodash';
|
||||
import { capitalize, get, includes } from 'lodash';
|
||||
import { router } from 'app';
|
||||
|
||||
// Design
|
||||
@ -82,7 +82,7 @@ class ListRow extends React.Component { // eslint-disable-line react/prefer-stat
|
||||
<i className={`fa fa-${this.props.item.icon}`} />
|
||||
</div>
|
||||
<div>
|
||||
{this.props.item.name}
|
||||
{capitalize(this.props.item.name)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -24,12 +24,20 @@
|
||||
display: flex;
|
||||
padding-left: 7px;
|
||||
font-weight: 600;
|
||||
text-transform: capitalize;
|
||||
// text-transform: capitalize;
|
||||
> div:first-child {
|
||||
width: 17px;
|
||||
padding-top: 2px;
|
||||
> i {
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
> div:last-child {
|
||||
width: 80%;
|
||||
margin-left: 52px;
|
||||
margin-left: 54px;
|
||||
padding-left: 7px;
|
||||
text-align: left;
|
||||
font-weight: 500 !important;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -49,6 +49,10 @@ class Plugin extends React.Component { // eslint-disable-line react/prefer-state
|
||||
const icon = get(this.context.plugins.toJS(), [this.props.name, 'icon']);
|
||||
const emptyApplication = !isEmpty(get(this.props.plugin, 'controllers'));
|
||||
|
||||
if (!emptyApplication) {
|
||||
return <div />;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={styles.plugin} style={divStyle}>
|
||||
<div className={styles.banner} onClick={this.handleClick}>
|
||||
|
||||
@ -110,7 +110,7 @@ class PopUpForm extends React.Component { // eslint-disable-line react/prefer-st
|
||||
validations={{}}
|
||||
value={get(this.props.values, 'enabled', this.state.enabled)}
|
||||
/>
|
||||
|
||||
|
||||
{form.length > 1 && <div className={styles.separator} /> }
|
||||
|
||||
{map(tail(form), (value, key) => (
|
||||
@ -173,7 +173,7 @@ class PopUpForm extends React.Component { // eslint-disable-line react/prefer-st
|
||||
label={`users-permissions.PopUpForm.Email.${value}.label`}
|
||||
name={`${dataToEdit}.${value}`}
|
||||
inputDescription={includes(value, 'object') ? 'users-permissions.PopUpForm.Email.email_templates.inputDescription' : ''}
|
||||
linkContent={includes(value, 'object') ? { link: 'https://strapi.io/documentation/plugin-development/ui-components.html', description: 'users-permissions.PopUpForm.Email.link.documentation' } : {}}
|
||||
linkContent={includes(value, 'object') ? { link: 'https://github.com/strapi/strapi/blob/master/packages/strapi-plugin-users-permissions/docs/email-templates.md', description: 'users-permissions.PopUpForm.Email.link.documentation' } : {}}
|
||||
onChange={this.props.onChange}
|
||||
placeholder={`users-permissions.PopUpForm.Email.${this.props.dataToEdit}.${value}.placeholder`}
|
||||
type={includes(value, 'object') ? 'text' : 'textarea'}
|
||||
|
||||
@ -53,7 +53,7 @@
|
||||
border-bottom: 1px solid #F6F6F6;
|
||||
position: relative;
|
||||
> button {
|
||||
margin-right: -1.5rem;
|
||||
margin-right: -2.5rem !important;
|
||||
color: #C3C5C8;
|
||||
opacity: 1;
|
||||
font-size: 1.8rem;
|
||||
|
||||
@ -60,7 +60,7 @@
|
||||
"EditForm.inputSelect.durations.label": "Duration",
|
||||
"EditForm.inputSelect.durations.description": "Number of hours during the user can't subscribe.",
|
||||
|
||||
"EditForm.inputToggle.label.email": "One account per email addres",
|
||||
"EditForm.inputToggle.label.email": "One account per email address",
|
||||
"EditForm.inputToggle.label.sign-up": "Enable sign-up",
|
||||
"EditForm.inputToggle.description.email": "Disallow the user to create multiple accounts using the same email address with different authentication providers.",
|
||||
"EditForm.inputToggle.description.sign-up": "When disabled (OFF), the registration process is forbidden. No one can subscribe anymore no matter the used provider.",
|
||||
@ -168,6 +168,6 @@
|
||||
"PopUpForm.Providers.twitter.providerConfig.redirectURL": "The redirect URL to add in your Twitter application configurations",
|
||||
|
||||
"PopUpForm.Providers.callback.placeholder": "TEXT",
|
||||
"PopUpForm.Email.email_templates.inputDescription": "Don't know to set variables",
|
||||
"PopUpForm.Email.email_templates.inputDescription": "Don't know how to set variables",
|
||||
"PopUpForm.Email.link.documentation": "check out our documentation."
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@
|
||||
"EditForm.inputSelect.durations.label": "Duration",
|
||||
"EditForm.inputSelect.durations.description": "Nombre d'heure pendant lesquelles un utilisateur ne peut souscrire.",
|
||||
|
||||
"EditForm.inputToggle.label": "Un compte par adresse email",
|
||||
"EditForm.inputToggle.label.email": "Un compte par adresse email",
|
||||
"EditForm.inputToggle.label.sign-up": "Activer l'inscription",
|
||||
"EditForm.inputToggle.description.email": "Interdire l'utilisateur de créer de multiple comptes avec la même adresse email avec des providers différents",
|
||||
"EditForm.inputToggle.description.sign-up": "Quand l'inscription est désactivée (OFF), aucun utilisateur ne peut s'inscrire qu'importe le provider",
|
||||
|
||||
@ -3,4 +3,4 @@
|
||||
"unique_email": true,
|
||||
"allow_register": true
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -96,11 +96,11 @@ module.exports = cb => {
|
||||
object: 'Reset password 🔑 ',
|
||||
message: `<p>We heard that you lost your password. Sorry about that!</p>
|
||||
|
||||
<p>But don’t worry! You can use the following link to reset your password:</p>
|
||||
<p>But don’t worry! You can use the following link to reset your password:</p>
|
||||
|
||||
<p><%= URL %>?code=<%= TOKEN %></p>
|
||||
<p><%= URL %>?code=<%= TOKEN %></p>
|
||||
|
||||
<p>Thanks.</p>`
|
||||
<p>Thanks.</p>`
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
# Templating emails
|
||||
|
||||
Documentation in progress....
|
||||
@ -0,0 +1,13 @@
|
||||
# Templating emails
|
||||
|
||||
By default, this plugin comes with only one template (reset password) for the moment. More templates will come later. The templates use Lodash' template() method to populate the variables.
|
||||
|
||||
|
||||
### Reset Password
|
||||
|
||||
- `USER` (object)
|
||||
- `username`
|
||||
- `email`
|
||||
- ...and every other fields that you added manually in the model.
|
||||
- `TOKEN` corresponds to the token generated to be able to reset the password.
|
||||
- `URL` is the link where the user will be redirected after clicking on it in the email.
|
||||
Loading…
x
Reference in New Issue
Block a user