sforkowany z mirror/soapbox
Merge remote-tracking branch 'origin/develop' into next
commit
ca1b4ff73d
|
@ -45,11 +45,19 @@ export default @connect(mapStateToProps)
|
||||||
class RegistrationForm extends ImmutablePureComponent {
|
class RegistrationForm extends ImmutablePureComponent {
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
|
intl: PropTypes.object.isRequired,
|
||||||
instance: ImmutablePropTypes.map,
|
instance: ImmutablePropTypes.map,
|
||||||
locale: PropTypes.string,
|
locale: PropTypes.string,
|
||||||
intl: PropTypes.object.isRequired,
|
needsConfirmation: PropTypes.bool,
|
||||||
|
needsApproval: PropTypes.bool,
|
||||||
|
supportsEmailList: PropTypes.bool,
|
||||||
|
inviteToken: PropTypes.string,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static contextTypes = {
|
||||||
|
router: PropTypes.object,
|
||||||
|
};
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
captchaLoading: true,
|
captchaLoading: true,
|
||||||
submissionLoading: false,
|
submissionLoading: false,
|
||||||
|
@ -94,17 +102,29 @@ class RegistrationForm extends ImmutablePureComponent {
|
||||||
|
|
||||||
postRegisterAction = ({ access_token }) => {
|
postRegisterAction = ({ access_token }) => {
|
||||||
const { dispatch, needsConfirmation, needsApproval } = this.props;
|
const { dispatch, needsConfirmation, needsApproval } = this.props;
|
||||||
|
const { router } = this.context;
|
||||||
|
|
||||||
if (needsConfirmation || needsApproval) {
|
if (needsConfirmation || needsApproval) {
|
||||||
return this.launchModal();
|
return this.launchModal();
|
||||||
} else {
|
} else {
|
||||||
return dispatch(verifyCredentials(access_token));
|
return dispatch(verifyCredentials(access_token)).then(() => {
|
||||||
|
router.history.push('/');
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onSubmit = e => {
|
onSubmit = e => {
|
||||||
const { dispatch } = this.props;
|
const { dispatch, inviteToken } = this.props;
|
||||||
const params = this.state.params.set('locale', this.props.locale);
|
|
||||||
|
const params = this.state.params.withMutations(params => {
|
||||||
|
// Locale for confirmation email
|
||||||
|
params.set('locale', this.props.locale);
|
||||||
|
|
||||||
|
// Pleroma invites
|
||||||
|
if (inviteToken) {
|
||||||
|
params.set('token', inviteToken);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
this.setState({ submissionLoading: true });
|
this.setState({ submissionLoading: true });
|
||||||
|
|
||||||
|
@ -140,40 +160,12 @@ class RegistrationForm extends ImmutablePureComponent {
|
||||||
render() {
|
render() {
|
||||||
const { instance, intl, supportsEmailList } = this.props;
|
const { instance, intl, supportsEmailList } = this.props;
|
||||||
const { params } = this.state;
|
const { params } = this.state;
|
||||||
const isOpen = instance.get('registrations');
|
|
||||||
const isLoading = this.state.captchaLoading || this.state.submissionLoading;
|
const isLoading = this.state.captchaLoading || this.state.submissionLoading;
|
||||||
|
|
||||||
if (isOpen === false) {
|
|
||||||
return (
|
|
||||||
<div className='registrations-closed'>
|
|
||||||
<h2>
|
|
||||||
<FormattedMessage
|
|
||||||
id='registration.closed_title'
|
|
||||||
defaultMessage='Registrations Closed'
|
|
||||||
/>
|
|
||||||
</h2>
|
|
||||||
<div className='registrations-closed__message'>
|
|
||||||
<FormattedMessage
|
|
||||||
id='registration.closed_message'
|
|
||||||
defaultMessage='{instance} is not accepting new members'
|
|
||||||
values={{ instance: <strong>{instance.get('title')}</strong> }}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SimpleForm onSubmit={this.onSubmit}>
|
<SimpleForm onSubmit={this.onSubmit}>
|
||||||
<fieldset disabled={isLoading || !isOpen}>
|
<fieldset disabled={isLoading}>
|
||||||
<div className='simple_form__overlay-area'>
|
<div className='simple_form__overlay-area'>
|
||||||
<p className='lead'>
|
|
||||||
<FormattedMessage
|
|
||||||
id='registration.lead'
|
|
||||||
defaultMessage="With an account on {instance} you'll be able to follow people on any server in the fediverse."
|
|
||||||
values={{ instance: <strong>{instance.get('title')}</strong> }}
|
|
||||||
/>
|
|
||||||
</p>
|
|
||||||
<div className='fields-group'>
|
<div className='fields-group'>
|
||||||
<TextInput
|
<TextInput
|
||||||
placeholder={intl.formatMessage(messages.username)}
|
placeholder={intl.formatMessage(messages.username)}
|
|
@ -1,8 +1,9 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
import { FormattedMessage } from 'react-intl';
|
||||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import RegistrationForm from './components/registration_form';
|
import RegistrationForm from '../auth_login/components/registration_form';
|
||||||
import SiteBanner from '../public_layout/components/site_banner';
|
import SiteBanner from '../public_layout/components/site_banner';
|
||||||
|
|
||||||
const mapStateToProps = (state, props) => ({
|
const mapStateToProps = (state, props) => ({
|
||||||
|
@ -11,8 +12,31 @@ const mapStateToProps = (state, props) => ({
|
||||||
|
|
||||||
class LandingPage extends ImmutablePureComponent {
|
class LandingPage extends ImmutablePureComponent {
|
||||||
|
|
||||||
|
renderClosed = () => {
|
||||||
|
const { instance } = this.props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='registrations-closed'>
|
||||||
|
<h2>
|
||||||
|
<FormattedMessage
|
||||||
|
id='registration.closed_title'
|
||||||
|
defaultMessage='Registrations Closed'
|
||||||
|
/>
|
||||||
|
</h2>
|
||||||
|
<div className='registrations-closed__message'>
|
||||||
|
<FormattedMessage
|
||||||
|
id='registration.closed_message'
|
||||||
|
defaultMessage='{instance} is not accepting new members'
|
||||||
|
values={{ instance: <strong>{instance.get('title')}</strong> }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { instance } = this.props;
|
const { instance } = this.props;
|
||||||
|
const isOpen = instance.get('registrations', false) === true;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='landing'>
|
<div className='landing'>
|
||||||
|
@ -28,7 +52,7 @@ class LandingPage extends ImmutablePureComponent {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className='landing-columns--right'>
|
<div className='landing-columns--right'>
|
||||||
<RegistrationForm />
|
{isOpen ? <RegistrationForm /> : this.renderClosed()}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
import React from 'react';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import { FormattedMessage } from 'react-intl';
|
||||||
|
import RegistrationForm from 'soapbox/features/auth_login/components/registration_form';
|
||||||
|
|
||||||
|
const mapStateToProps = state => {
|
||||||
|
return {
|
||||||
|
siteTitle: state.getIn(['instance', 'title']),
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export default @connect(mapStateToProps)
|
||||||
|
class RegisterInvite extends React.Component {
|
||||||
|
|
||||||
|
static propTypes = {
|
||||||
|
params: PropTypes.object.isRequired,
|
||||||
|
siteTitle: PropTypes.string.isRequired,
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const { siteTitle, params } = this.props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='register-invite'>
|
||||||
|
<div className='register-invite__header'>
|
||||||
|
<h1 className='register-invite__title'>
|
||||||
|
<FormattedMessage
|
||||||
|
id='register_invite.title'
|
||||||
|
defaultMessage="You've been invited to join {siteTitle}!"
|
||||||
|
values={{ siteTitle }}
|
||||||
|
/>
|
||||||
|
</h1>
|
||||||
|
<p className='register-invite__lead'>
|
||||||
|
<FormattedMessage
|
||||||
|
id='register_invite.lead'
|
||||||
|
defaultMessage='Complete the form below to create an account.'
|
||||||
|
/>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div className='register-invite__form'>
|
||||||
|
<RegistrationForm inviteToken={params.token} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -109,6 +109,7 @@ import {
|
||||||
NotificationsContainer,
|
NotificationsContainer,
|
||||||
ModalContainer,
|
ModalContainer,
|
||||||
ProfileHoverCard,
|
ProfileHoverCard,
|
||||||
|
RegisterInvite,
|
||||||
} from './util/async-components';
|
} from './util/async-components';
|
||||||
|
|
||||||
// Dummy import, to make sure that <Status /> ends up in the application bundle.
|
// Dummy import, to make sure that <Status /> ends up in the application bundle.
|
||||||
|
@ -282,6 +283,9 @@ class SwitchingColumnsArea extends React.PureComponent {
|
||||||
<WrappedRoute path='/statuses/:statusId' exact component={Status} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} />
|
<WrappedRoute path='/statuses/:statusId' exact component={Status} content={children} componentParams={{ shouldUpdateScroll: this.shouldUpdateScroll }} />
|
||||||
<WrappedRoute path='/scheduled_statuses' page={DefaultPage} component={ScheduledStatuses} content={children} />
|
<WrappedRoute path='/scheduled_statuses' page={DefaultPage} component={ScheduledStatuses} content={children} />
|
||||||
|
|
||||||
|
<Redirect from='/registration/:token' to='/invite/:token' />
|
||||||
|
<WrappedRoute path='/invite/:token' component={RegisterInvite} content={children} publicRoute />
|
||||||
|
|
||||||
<Redirect exact from='/settings' to='/settings/preferences' />
|
<Redirect exact from='/settings' to='/settings/preferences' />
|
||||||
<WrappedRoute path='/settings/preferences' page={DefaultPage} component={Preferences} content={children} />
|
<WrappedRoute path='/settings/preferences' page={DefaultPage} component={Preferences} content={children} />
|
||||||
<WrappedRoute path='/settings/profile' page={DefaultPage} component={EditProfile} content={children} />
|
<WrappedRoute path='/settings/profile' page={DefaultPage} component={EditProfile} content={children} />
|
||||||
|
@ -489,9 +493,9 @@ class UI extends React.PureComponent {
|
||||||
componentDidUpdate(prevProps) {
|
componentDidUpdate(prevProps) {
|
||||||
this.connectStreaming();
|
this.connectStreaming();
|
||||||
|
|
||||||
const { dispatch, features } = this.props;
|
const { dispatch, account, features } = this.props;
|
||||||
|
|
||||||
if (features.chats && !prevProps.features.chats) {
|
if (features.chats && account && !prevProps.features.chats) {
|
||||||
dispatch(fetchChats());
|
dispatch(fetchChats());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -405,3 +405,7 @@ export function WhoToFollowPanel() {
|
||||||
export function FollowRecommendations() {
|
export function FollowRecommendations() {
|
||||||
return import(/* webpackChunkName: "features/follow_recommendations" */'../../follow_recommendations');
|
return import(/* webpackChunkName: "features/follow_recommendations" */'../../follow_recommendations');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function RegisterInvite() {
|
||||||
|
return import(/* webpackChunkName: "features/register_invite" */'../../register_invite');
|
||||||
|
}
|
||||||
|
|
|
@ -89,6 +89,7 @@
|
||||||
@import 'components/icon';
|
@import 'components/icon';
|
||||||
@import 'components/profile-stats';
|
@import 'components/profile-stats';
|
||||||
@import 'components/progress-circle';
|
@import 'components/progress-circle';
|
||||||
|
@import 'components/register-invite';
|
||||||
|
|
||||||
// Holiday
|
// Holiday
|
||||||
@import 'holiday/halloween';
|
@import 'holiday/halloween';
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
.register-invite {
|
||||||
|
margin: 10px 0;
|
||||||
|
|
||||||
|
&__header {
|
||||||
|
padding: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__title {
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 25px;
|
||||||
|
line-height: normal;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__form {
|
||||||
|
.simple_form {
|
||||||
|
input[type=text],
|
||||||
|
input[type=number],
|
||||||
|
input[type=email],
|
||||||
|
input[type=password],
|
||||||
|
textarea {
|
||||||
|
background-color: var(--foreground-color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -316,7 +316,7 @@ code {
|
||||||
outline: 0;
|
outline: 0;
|
||||||
font-family: inherit;
|
font-family: inherit;
|
||||||
resize: vertical;
|
resize: vertical;
|
||||||
background: var(--background-color);
|
background-color: var(--background-color);
|
||||||
border: 1px solid var(--highlight-text-color);
|
border: 1px solid var(--highlight-text-color);
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
|
Ładowanie…
Reference in New Issue