Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only pick required fields to register for newsletter updates #6732

Merged
merged 1 commit into from
Jun 18, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 9 additions & 11 deletions packages/strapi-admin/admin/src/containers/AuthPage/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { memo, useEffect, useReducer, useRef } from 'react';
import PropTypes from 'prop-types';
import { get, isEmpty, omit, set, upperFirst } from 'lodash';
import { get, isEmpty, omit, set, upperFirst, pick } from 'lodash';
import { FormattedMessage } from 'react-intl';
import { Link, Redirect } from 'react-router-dom';
import { Button } from '@buffetjs/core';
Expand Down Expand Up @@ -65,16 +65,14 @@ const AuthPage = ({
try {
await schema.validate(modifiedData, { abortEarly: false });

try {
if (modifiedData.news === true) {
await request('https://analytics.strapi.io/register', {
method: 'POST',
body: omit(modifiedData, ['password', 'confirmPassword']),
signal,
});
}
} catch (err) {
// Do nothing
if (modifiedData.news === true) {
request('https://analytics.strapi.io/register', {
method: 'POST',
body: pick(modifiedData, ['email', 'username']),
signal,
}).catch(() => {
// ignore error
});
}

try {
Expand Down