@@ -6,11 +6,9 @@ import _ from 'lodash'
66
77 angular . module ( 'tc.account' ) . controller ( 'RegisterController' , RegisterController )
88
9- RegisterController . $inject = [ '$log ' , 'CONSTANTS' , '$state' , '$stateParams' , 'TcAuthService' , 'UserService' , 'ISO3166' , 'Helpers' ]
9+ RegisterController . $inject = [ 'logger ' , 'CONSTANTS' , '$state' , '$stateParams' , 'TcAuthService' , 'UserService' , 'ISO3166' , 'Helpers' ]
1010
11- function RegisterController ( $log , CONSTANTS , $state , $stateParams , TcAuthService , UserService , ISO3166 , Helpers ) {
12- $log = $log . getInstance ( 'RegisterController' )
13- $log . debug ( '-init' )
11+ function RegisterController ( logger , CONSTANTS , $state , $stateParams , TcAuthService , UserService , ISO3166 , Helpers ) {
1412 var vm = this
1513 vm . registering = false
1614 // prepares utm params, if available
@@ -20,18 +18,10 @@ import _ from 'lodash'
2018 campaign : $stateParams && $stateParams . utm_campaign ? $stateParams . utm_campaign : ''
2119 }
2220
23-
2421 // Set default for toggle password directive
2522 vm . defaultPlaceholder = 'Create Password'
2623 vm . busyMessage = CONSTANTS . BUSY_PROGRESS_MESSAGE
2724
28- // FIXME - This needs to be setup with https
29- // lookup users country
30- // Helpers.getCountyObjFromIP()
31- // .then(function(obj) {
32- // vm.countryObj = obj
33- // })
34-
3525 vm . countries = ISO3166 . getAllCountryObjects ( )
3626
3727 vm . updateCountry = function ( angucompleteCountryObj ) {
@@ -85,18 +75,18 @@ import _ from 'lodash'
8575 }
8676 }
8777
88- $log . debug ( 'attempting to register user' )
8978 TcAuthService . register ( body )
9079 . then ( function ( data ) {
9180 vm . registering = false
92- $log . debug ( 'registered successfully' )
81+ logger . debug ( 'Registered successfully' )
9382
9483 // In the future, go to dashboard
9584 $state . go ( 'registeredSuccessfully' )
9685 } )
9786 . catch ( function ( err ) {
9887 vm . registering = false
99- $log . error ( 'Error in registering new user: ' , err )
88+
89+ logger . error ( 'Error in registering new user' , err )
10090 } )
10191 }
10292
@@ -130,17 +120,22 @@ import _ from 'lodash'
130120 vm . isSocialRegistration = false
131121 }
132122 } )
133- . catch ( function ( result ) {
134- switch ( result . status ) {
135- case 'SOCIAL_PROFILE_ALREADY_EXISTS' :
136- vm . errMsg = 'An account with that profile already exists. Please login to access your account.'
137- break
138- default :
139- vm . errMsg = 'Whoops! Something went wrong. Please try again later.'
140- break
141- }
142- vm . isSocialRegistration = false
143- } )
123+ . catch ( function ( err ) {
124+ switch ( err . status ) {
125+ case 'SOCIAL_PROFILE_ALREADY_EXISTS' :
126+ vm . errMsg = 'An account with that profile already exists. Please login to access your account.'
127+
128+ logger . error ( 'Error registering user with social account' , err )
129+
130+ break
131+
132+ default :
133+ vm . errMsg = 'Whoops! Something went wrong. Please try again later.'
134+
135+ logger . error ( 'Error registering user with social account' , err )
136+ }
137+ vm . isSocialRegistration = false
138+ } )
144139 }
145140
146141 vm . $stateParams = $stateParams
0 commit comments