Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/constants/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ export default {
Accounts_EmailOrUsernamePlaceholder: {
type: 'valueAsString'
},
Accounts_EmailVerification: {
type: 'valueAsBoolean'
},
Accounts_NamePlaceholder: {
type: 'valueAsString'
},
Expand Down
2 changes: 2 additions & 0 deletions app/i18n/locales/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,8 @@ export default {
Username: 'Username',
Username_or_email: 'Username or email',
Validating: 'Validating',
Verify_email_title: 'Registration Succeded!',
Verify_email_desc: 'We have sent you an email to confirm your registration. If you do not receive an email shortly, please come back and try again.',
Video_call: 'Video call',
View_Original: 'View Original',
Voice_call: 'Voice call',
Expand Down
14 changes: 11 additions & 3 deletions app/views/RegisterView.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class RegisterView extends React.Component {
loginRequest: PropTypes.func,
Site_Name: PropTypes.string,
Accounts_CustomFields: PropTypes.string,
Accounts_EmailVerification: PropTypes.bool,
theme: PropTypes.string
}

Expand Down Expand Up @@ -119,13 +120,19 @@ class RegisterView extends React.Component {
const {
name, email, password, username, customFields
} = this.state;
const { loginRequest } = this.props;
const { loginRequest, Accounts_EmailVerification, navigation } = this.props;

try {
await RocketChat.register({
name, email, pass: password, username, ...customFields
});
await loginRequest({ user: email, password });

if (Accounts_EmailVerification) {
await navigation.goBack();
Alert.alert(I18n.t('Verify_email_title'), I18n.t('Verify_email_desc'));
} else {
await loginRequest({ user: email, password });
}
} catch (e) {
Alert.alert(I18n.t('Oops'), e.data.error);
}
Expand Down Expand Up @@ -267,7 +274,8 @@ class RegisterView extends React.Component {
}

const mapStateToProps = state => ({
Accounts_CustomFields: state.settings.Accounts_CustomFields
Accounts_CustomFields: state.settings.Accounts_CustomFields,
Accounts_EmailVerification: state.settings.Accounts_EmailVerification
});

const mapDispatchToProps = dispatch => ({
Expand Down