Add support for custom sign-up URLs (#25014)
This commit is contained in:
		
					parent
					
						
							
								dfa5889fc0
							
						
					
				
			
			
				commit
				
					
						ca66e61b93
					
				
			
		
					 5 changed files with 19 additions and 9 deletions
				
			
		|  | @ -16,6 +16,10 @@ const Account = connect(state => ({ | |||
|   </Link> | ||||
| )); | ||||
| 
 | ||||
| const mapStateToProps = (state) => ({ | ||||
|   signupUrl: state.getIn(['server', 'server', 'registrations', 'url'], '/auth/sign_up'), | ||||
| }); | ||||
| 
 | ||||
| const mapDispatchToProps = (dispatch) => ({ | ||||
|   openClosedRegistrationsModal() { | ||||
|     dispatch(openModal('CLOSED_REGISTRATIONS')); | ||||
|  | @ -31,11 +35,12 @@ class Header extends PureComponent { | |||
|   static propTypes = { | ||||
|     openClosedRegistrationsModal: PropTypes.func, | ||||
|     location: PropTypes.object, | ||||
|     signupUrl: PropTypes.string.isRequired, | ||||
|   }; | ||||
| 
 | ||||
|   render () { | ||||
|     const { signedIn } = this.context.identity; | ||||
|     const { location, openClosedRegistrationsModal } = this.props; | ||||
|     const { location, openClosedRegistrationsModal, signupUrl } = this.props; | ||||
| 
 | ||||
|     let content; | ||||
| 
 | ||||
|  | @ -51,7 +56,7 @@ class Header extends PureComponent { | |||
| 
 | ||||
|       if (registrationsOpen) { | ||||
|         signupButton = ( | ||||
|           <a href='/auth/sign_up' className='button'> | ||||
|           <a href={signupUrl} className='button'> | ||||
|             <FormattedMessage id='sign_in_banner.create_account' defaultMessage='Create account' /> | ||||
|           </a> | ||||
|         ); | ||||
|  | @ -87,4 +92,4 @@ class Header extends PureComponent { | |||
| 
 | ||||
| } | ||||
| 
 | ||||
| export default withRouter(connect(null, mapDispatchToProps)(Header)); | ||||
| export default withRouter(connect(mapStateToProps, mapDispatchToProps)(Header)); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue