@@ -8,7 +8,7 @@ import SelectProduct from './SelectProduct'
88import IncompleteProjectConfirmation from './IncompleteProjectConfirmation'
99import FillProjectDetails from './FillProjectDetails'
1010import update from 'react-addons-update'
11- import { LS_INCOMPLETE_PROJECT } from '../../../config/constants'
11+ import { LS_INCOMPLETE_PROJECT , PROJECT_REF_CODE_MAX_LENGTH } from '../../../config/constants'
1212import './ProjectWizard.scss'
1313
1414const WZ_STEP_INCOMP_PROJ_CONF = 0
@@ -65,14 +65,15 @@ class ProjectWizard extends Component {
6565 wizardStep = WZ_STEP_FILL_PROJ_DETAILS
6666 }
6767 }
68- // retrieve refcode from query param
69- const refcode = _ . get ( location , 'query.refcode' )
70- if ( refcode ) {
71- // if refcode exists, update the updateQuery to set that refcode
68+ // retrieve refCode from query param
69+ // TODO give warning after truncating
70+ const refCode = _ . get ( location , 'query.refCode' , '' ) . trim ( ) . substr ( 0 , PROJECT_REF_CODE_MAX_LENGTH )
71+ if ( refCode . trim ( ) . length > 0 ) {
72+ // if refCode exists, update the updateQuery to set that refCode
7273 if ( _ . get ( updateQuery , 'details' ) ) {
73- updateQuery [ 'details' ] [ 'utm' ] = { $set : { code : refcode } }
74+ updateQuery [ 'details' ] [ 'utm' ] = { $set : { code : refCode } }
7475 } else {
75- updateQuery [ 'details' ] = { utm : { $set : { code : refcode } } }
76+ updateQuery [ 'details' ] = { utm : { $set : { code : refCode } } }
7677 }
7778 }
7879 this . setState ( {
0 commit comments