MCPcopy Create free account
hub / github.com/codecombat/codecombat / success

Method success

app/views/core/AuthModal.js:168–228  ·  view source on GitHub ↗
(resp)

Source from the content-addressed store, hash-verified

166 return application.gplusHandler.connect({
167 context: this,
168 success (resp) {
169 if (resp == null) { resp = {} }
170 btn.find('.sign-in-blurb').text($.i18n.t('login.logging_in'))
171 btn.attr('disabled', true)
172 return application.gplusHandler.loadPerson({
173 resp,
174 context: this,
175 success (gplusAttrs) {
176 const existingUser = new User()
177 return existingUser.fetchGPlusUser(gplusAttrs.gplusID, gplusAttrs.email, {
178 success: () => {
179 return me.loginGPlusUser(gplusAttrs.gplusID, {
180 success: () => {
181 application.tracker.identifyAfterNextPageLoad()
182 return application.tracker.identify().finally(() => {
183 return loginNavigate(this.subModalContinue)
184 })
185 },
186 error: this.onGPlusLoginError,
187 })
188 },
189 error: (res, jqxhr) => {
190 if ((jqxhr.status === 409) && jqxhr.responseJSON.errorID && (jqxhr.responseJSON.errorID === 'account-with-email-exists')) {
191 const mergeLogin = (gplusAttrs) => {
192 return me.loginGPlusUser(gplusAttrs.gplusID, {
193 data: { merge: true, email: gplusAttrs.email },
194 success: () => {
195 application.tracker.identifyAfterNextPageLoad()
196 return application.tracker.identify().finally(() => {
197 return loginNavigate(this.subModalContinue)
198 })
199 },
200 error: this.onGPlusLoginError,
201 })
202 }
203
204 // auto-merge since we roster and create accounts for them
205 if (gplusAttrs.email?.includes(User.getNapervilleDomain())) {
206 return mergeLogin(gplusAttrs)
207 }
208 return noty({
209 text: $.i18n.t('login.accounts_merge_confirmation'),
210 layout: 'topCenter',
211 type: 'info',
212 buttons: [
213 {
214 text: 'Yes',
215 onClick ($noty) {
216 $noty.close()
217 return mergeLogin(gplusAttrs)
218 },
219 }, { text: 'No', onClick ($noty) { return $noty.close() } }],
220 })
221 } else {
222 return this.onGPlusLoginError(res, jqxhr)
223 }
224 },
225 })

Callers 2

onClickSaveButtonMethod · 0.45
onSaveModelMethod · 0.45

Calls 10

fetchGPlusUserMethod · 0.95
onGPlusLoginErrorMethod · 0.95
fetchFacebookUserMethod · 0.95
loginNavigateFunction · 0.85
loginGPlusUserMethod · 0.80
getNapervilleDomainMethod · 0.80
loginFacebookUserMethod · 0.80
loadPersonMethod · 0.45
identifyMethod · 0.45

Tested by

no test coverage detected