add reason field on registration when by approval mode is on
This commit is contained in:
parent
444e3641ee
commit
209f826c15
3 changed files with 19 additions and 3 deletions
|
@ -834,6 +834,7 @@
|
||||||
"registration.lead": "With an account on {instance} you\"ll be able to follow people on any server in the fediverse.",
|
"registration.lead": "With an account on {instance} you\"ll be able to follow people on any server in the fediverse.",
|
||||||
"registration.sign_up": "Sign up",
|
"registration.sign_up": "Sign up",
|
||||||
"registration.tos": "Terms of Service",
|
"registration.tos": "Terms of Service",
|
||||||
|
"registration.reason": "Reason for Joining",
|
||||||
"relative_time.days": "{number}d",
|
"relative_time.days": "{number}d",
|
||||||
"relative_time.hours": "{number}h",
|
"relative_time.hours": "{number}h",
|
||||||
"relative_time.just_now": "now",
|
"relative_time.just_now": "now",
|
||||||
|
|
|
@ -133,15 +133,20 @@ export function logOut() {
|
||||||
export function register(params) {
|
export function register(params) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
const needsConfirmation = getState().getIn(['instance', 'pleroma', 'metadata', 'account_activation_required']);
|
const needsConfirmation = getState().getIn(['instance', 'pleroma', 'metadata', 'account_activation_required']);
|
||||||
|
const needsApproval = getState().getIn(['instance', 'approval_required']);
|
||||||
dispatch({ type: AUTH_REGISTER_REQUEST });
|
dispatch({ type: AUTH_REGISTER_REQUEST });
|
||||||
return dispatch(createAppAndToken()).then(() => {
|
return dispatch(createAppAndToken()).then(() => {
|
||||||
return api(getState, 'app').post('/api/v1/accounts', params);
|
return api(getState, 'app').post('/api/v1/accounts', params);
|
||||||
}).then(response => {
|
}).then(response => {
|
||||||
dispatch({ type: AUTH_REGISTER_SUCCESS, token: response.data });
|
dispatch({ type: AUTH_REGISTER_SUCCESS, token: response.data });
|
||||||
dispatch(authLoggedIn(response.data));
|
dispatch(authLoggedIn(response.data));
|
||||||
return needsConfirmation
|
if (needsConfirmation) {
|
||||||
? dispatch(showAlert('', 'Check your email for further instructions.'))
|
return dispatch(showAlert('', 'Check your email for further instructions.'));
|
||||||
: dispatch(fetchMe());
|
} else if (needsApproval) {
|
||||||
|
return dispatch(showAlert('', 'Your account has been submitted for approval.'));
|
||||||
|
} else {
|
||||||
|
return dispatch(fetchMe());
|
||||||
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
dispatch({ type: AUTH_REGISTER_FAIL, error });
|
dispatch({ type: AUTH_REGISTER_FAIL, error });
|
||||||
throw error;
|
throw error;
|
||||||
|
|
|
@ -24,6 +24,7 @@ const messages = defineMessages({
|
||||||
confirm: { id: 'registration.fields.confirm_placeholder', defaultMessage: 'Password (again)' },
|
confirm: { id: 'registration.fields.confirm_placeholder', defaultMessage: 'Password (again)' },
|
||||||
agreement: { id: 'registration.agreement', defaultMessage: 'I agree to the {tos}.' },
|
agreement: { id: 'registration.agreement', defaultMessage: 'I agree to the {tos}.' },
|
||||||
tos: { id: 'registration.tos', defaultMessage: 'Terms of Service' },
|
tos: { id: 'registration.tos', defaultMessage: 'Terms of Service' },
|
||||||
|
reason: { id: 'registration.reason', defaultMessage: 'Reason for Joining' },
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapStateToProps = (state, props) => ({
|
const mapStateToProps = (state, props) => ({
|
||||||
|
@ -136,6 +137,15 @@ class RegistrationForm extends ImmutablePureComponent {
|
||||||
onChange={this.onInputChange}
|
onChange={this.onInputChange}
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
|
{instance.get('approval_required') &&
|
||||||
|
<TextInput
|
||||||
|
placeholder={intl.formatMessage(messages.reason)}
|
||||||
|
name='reason'
|
||||||
|
maxLength={500}
|
||||||
|
autoComplete='off'
|
||||||
|
onChange={this.onInputChange}
|
||||||
|
required
|
||||||
|
/>}
|
||||||
</div>
|
</div>
|
||||||
<CaptchaField
|
<CaptchaField
|
||||||
onFetch={this.onFetchCaptcha}
|
onFetch={this.onFetchCaptcha}
|
||||||
|
|
Loading…
Reference in a new issue