Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.31 KB | None | 0 0
  1. ;// bundle: authAppJs___89c208cd64e31806a550867f70e00d2c_ba7515af-0c9c-49f1-bccc-caea60ea2699_m
  2. ;// files: dist/login.js
  3.  
  4. ;// dist/login.js
  5. "use strict";
  6. robloxApp.directive("toggleLoading", [function() {
  7. return {
  8. restrict: "A",
  9. link: function(n, t, i) {
  10. var f = '<div class="spinner spinner-sm spinner-no-margin' + (i.isInline ? "" : " spinner-block") + '"></div>', r = angular.element(f), u;
  11. t.after(r),
  12. r.hide(),
  13. u = n.$watch(i.isLoading, function(n, i) {
  14. if (n !== i)
  15. if (n) {
  16. var u = t[0].offsetHeight
  17. , f = t[0].offsetWidth;
  18. r.css("height", u + "px"),
  19. r.css("width", f + "px"),
  20. t.hide(),
  21. r.show()
  22. } else
  23. t.show(),
  24. r.hide()
  25. }, !0),
  26. n.$on("$destroy", function() {
  27. u && u()
  28. })
  29. }
  30. }
  31. }
  32. ]),
  33. robloxApp.directive("systemFeedback", [function() {
  34. return {
  35. restrict: "A",
  36. replace: !1,
  37. templateUrl: "system-feedback",
  38. scope: {
  39. showErrorBanner: "=",
  40. bannerText: "="
  41. },
  42. link: function(n) {
  43. n.closeErrorBanner = function() {
  44. n.showErrorBanner = !1
  45. }
  46. }
  47. }
  48. }
  49. ]);
  50. var login = angular.module("login", ["captcha", "roblox.formEvents", "modal"]).config(["languageResourceProvider", function(n) {
  51. n.setLanguageKeysFromFile(Roblox.Lang.LoginResources),
  52. n.setLanguageKeysFromFile(Roblox.Lang.CaptchaResources)
  53. }
  54. ]);
  55. angular.element(function() {
  56. angular.bootstrap("#login-container", ["robloxApp", "authAppHtmlTemplateApp", "login"])
  57. }),
  58. login.constant("loginConstants", {
  59. urls: {
  60. metaData: "/login/meta-data",
  61. loginApi: "/v2/login",
  62. credentialsVerificationApi: "/v2/credentials/verification",
  63. credentialsVerificationSendApi: "/v2/credentials/verification/send",
  64. loginCaptchaApi: "/captcha/validate/login",
  65. twoStepVerification: "/login/twostepverification",
  66. forgotCredentials: "/login/forgot-password-or-username",
  67. games: "/games",
  68. home: "/home",
  69. securityNotification: "/login/securityNotification",
  70. login: "/login",
  71. redirectToFb: "/social/redirect-to-facebook",
  72. signUpRedirect: "/account/signupredir"
  73. },
  74. templates: {
  75. verifyEmail: "verify-email"
  76. },
  77. controllers: {
  78. verifyEmail: "verifyEmailController"
  79. },
  80. errorCodes: {
  81. unknownError: 0,
  82. badCredentials: 1,
  83. captcha: 2,
  84. accountNotFound: 3,
  85. passwordResetRequired: 4,
  86. noPassword: 5,
  87. accountIssue: 6,
  88. tooManyAttempts: 7,
  89. defaultLoginRequired: 9,
  90. unverifiedCredentials: 10,
  91. captchaLoadFailed: 11,
  92. captchaVerifyFailed: 12,
  93. captchaUnknownError: 13
  94. },
  95. sendVerificationEmailErrorCodes: {
  96. tooManyAttempts: 2
  97. },
  98. statusCodes: {
  99. flooded: 429
  100. },
  101. credentialTypes: {
  102. username: "Username",
  103. email: "Email",
  104. phone: "PhoneNumber"
  105. },
  106. urlQueryNames: {
  107. errorCode: "errorCode",
  108. cType: "ctype",
  109. username: "username",
  110. samlRequest: "samlRequest",
  111. samlRelayState: "samlRelayState"
  112. },
  113. counters: {
  114. prefix: "WebsiteLogin_",
  115. firstAttempt: "FirstAttempt",
  116. attempt: "Attempt",
  117. success: "Success",
  118. captcha: "Captcha",
  119. passwordResetRequired: "PasswordResetRequired",
  120. unverifiedAccount: "UnverifiedAccount",
  121. invalidCredentials: "InvalidCredentials",
  122. accountNotFound: "AccountNotFound",
  123. noPassword: "NoPassword",
  124. accountIssue: "AccountIssue",
  125. tooManyAttempts: "TooManyAttempts",
  126. defaultLoginRequired: "DefaultLoginRequired",
  127. redirectToLogin: "RedirectToLogin",
  128. captchaLoadFailed: "CaptchaLoadFailed",
  129. captchaVerifyFailed: "CaptchaVerifyFailed",
  130. captchaUnknownError: "CaptchaUnknownError",
  131. unknownError: "UnknownError"
  132. },
  133. newLoginQueryString: "nl=true",
  134. loginSubmitButtonName: "loginSubmit",
  135. fbLoginButtonName: "fbLoginSubmit",
  136. landingContext: "landing",
  137. atSymbol: "@",
  138. verifyEmailContextSuffix: "_verifyEmail"
  139. }),
  140. login.factory("loginService", ["httpService", "loginConstants", function(n, t) {
  141. return {
  142. getMetaData: function() {
  143. var i = {
  144. url: Roblox.EnvironmentUrls.authAppSite + t.urls.metaData
  145. };
  146. return n.httpGet(i)
  147. },
  148. login: function(i) {
  149. var r = {
  150. url: Roblox.EnvironmentUrls.authApi + t.urls.loginApi
  151. };
  152. return n.httpPost(r, i, !0)
  153. },
  154. canVerifyCredentials: function(i) {
  155. var r = {
  156. url: Roblox.EnvironmentUrls.authApi + t.urls.credentialsVerificationApi
  157. };
  158. return n.httpGet(r, i, !0)
  159. },
  160. verifyCredentials: function(i) {
  161. var r = {
  162. url: Roblox.EnvironmentUrls.authApi + t.urls.credentialsVerificationSendApi
  163. };
  164. return n.httpPost(r, i, !0)
  165. },
  166. setReturnUrl: function(n) {
  167. Roblox.Auth = Roblox.Auth || {},
  168. Roblox.Auth.returnUrl = n
  169. },
  170. getReturnUrl: function() {
  171. return Roblox.Auth && Roblox.Auth.returnUrl
  172. }
  173. }
  174. }
  175. ]),
  176. login.directive("loginBase", [function() {
  177. return {
  178. restrict: "A",
  179. replace: !1,
  180. templateUrl: "login-base",
  181. controller: "loginController",
  182. link: function(n, t, i) {
  183. n.loginBaseParams = {
  184. isLoginFunCaptchaEnabled: "true" === i.isLoginFunCaptchaEnabled,
  185. isAlwaysCaptchaLoginEnabled: "true" === i.isAlwaysCaptchaLoginEnabled
  186. }
  187. }
  188. }
  189. }
  190. ]),
  191. login.directive("loginForm", [function() {
  192. return {
  193. restrict: "A",
  194. replace: !1,
  195. templateUrl: "login-form",
  196. controller: "loginFormController",
  197. link: function(n, t, i) {
  198. n.loginParams = {
  199. context: i.context,
  200. redirectToLoginPageOnError: "true" === i.redirectToLoginPageOnError,
  201. redirectToHomePostLogin: "true" === i.redirectToHomePostLogin,
  202. redirectToLoginPageWhenUsernameIsRequired: "true" === i.redirectToLoginPageWhenUsernameIsRequired,
  203. isFacebookSignInEnabled: "true" === i.isFacebookSignInEnabled,
  204. useFacebookRedirect: "true" === i.useFacebookRedirect,
  205. includeMessageBanner: "true" === i.includeMessageBanner,
  206. isLoginFunCaptchaEnabled: "true" === i.isLoginFunCaptchaEnabled,
  207. isAlwaysCaptchaLoginEnabled: "true" === i.isAlwaysCaptchaLoginEnabled
  208. }
  209. }
  210. }
  211. }
  212. ]),
  213. login.controller("loginController", ["$scope", "$httpParamSerializerJQLike", "loginService", "urlConstants", "loginConstants", function(n, t, i, r, u) {
  214. var f = Roblox.EnvironmentUrls.websiteUrl + u.urls.signUpRedirect;
  215. n.loginData = {
  216. signUpUrl: f
  217. },
  218. n.init = function() {
  219. var t = i.getReturnUrl();
  220. t ? n.appendReturnUrlToSignUpUrl(t) : i.getMetaData().then(function(t) {
  221. i.setReturnUrl(t.ReturnUrl),
  222. n.appendReturnUrlToSignUpUrl(t.ReturnUrl)
  223. })
  224. }
  225. ,
  226. n.appendReturnUrlToSignUpUrl = function(i) {
  227. if (i) {
  228. var u = {
  229. returnUrl: i
  230. }
  231. , e = r.urlQueryStringPrefix + t(u);
  232. n.loginData.signUpUrl = f + e
  233. }
  234. }
  235. ,
  236. n.init()
  237. }
  238. ]),
  239. login.controller("loginFormController", ["$scope", "$injector", "$window", "$timeout", "$httpParamSerializerJQLike", "$uibModal", "urlService", "phoneService", "languageResource", "loginService", "captchaInterface", "loginConstants", "urlConstants", function(n, t, i, r, u, f, e, o, s, h, c, l, a) {
  240. n.loginFormData = {
  241. captchaApiUrl: Roblox.EnvironmentUrls.apiProxyUrl + l.urls.loginCaptchaApi,
  242. forgotCredentialsUrl: Roblox.EnvironmentUrls.websiteUrl + l.urls.forgotCredentials,
  243. homeUrl: Roblox.EnvironmentUrls.websiteUrl + l.urls.home,
  244. loginPageUrl: Roblox.EnvironmentUrls.websiteUrl + l.urls.login,
  245. securityNotificationUrl: Roblox.EnvironmentUrls.websiteUrl + l.urls.securityNotification,
  246. redirectToFb: Roblox.EnvironmentUrls.websiteUrl + l.urls.redirectToFb
  247. },
  248. n.loginLayout = {
  249. isFirstSubmit: !0
  250. },
  251. n.forms = {},
  252. n.loginParams = n.loginParams || {},
  253. n.funCaptchaSetting = {};
  254. var v = n.$watch(function() {
  255. return n.loginParams
  256. }, function(t) {
  257. var i, r;
  258. t && (i = n.getUrlParamValue(l.urlQueryNames.errorCode),
  259. i && !n.loginParams.redirectToLoginPageOnError ? (r = n.getUrlParamValue(l.urlQueryNames.cType),
  260. n.loginFormData.credentialValue = n.getUrlParamValue(l.urlQueryNames.username),
  261. n.setEnteredCredentialType(r),
  262. n.loginLayout.error = i ? n.getErrorMessage(parseInt(i, 10)) : null) : n.loginFormData.credentialValue = null,
  263. n.loginParams.isLoginFunCaptchaEnabled && (n.setFunCaptchaSetting(),
  264. n.loginLayout.forceCaptcha = !0))
  265. }, !0);
  266. n.getUrlParamValue = function(n) {
  267. if (!Roblox.UrlParser)
  268. return null;
  269. var t = Roblox.UrlParser.getParameterValueByName(n);
  270. return t ? encodeURIComponent(t) : t
  271. }
  272. ,
  273. n.$on("$destroy", function() {
  274. v()
  275. }),
  276. n.init = function(t) {
  277. h.getMetaData().then(function(t) {
  278. angular.extend(n.loginFormData, {
  279. returnUrl: t.ReturnUrl
  280. }),
  281. h.setReturnUrl(t.ReturnUrl)
  282. }),
  283. n.loginLayout.isProcessing = !1,
  284. n.captchaSetting = {
  285. id: t || c.ids.login,
  286. isActivated: !1,
  287. captchaType: c.types.login,
  288. successCB: null,
  289. errorCB: null
  290. },
  291. n.loginFormData.samlRequest = n.getUrlParamValue(l.urlQueryNames.samlRequest),
  292. n.loginFormData.samlRelayState = n.getUrlParamValue(l.urlQueryNames.samlRelayState)
  293. }
  294. ,
  295. n.setFunCaptchaSetting = function() {
  296. var i = t.get("funCaptchaInterface");
  297. n.funCaptchaSetting = {
  298. id: i.ids.login,
  299. isActivated: !1,
  300. captchaType: i.types.login,
  301. successCb: function() {
  302. n.loginLayout.forceCaptcha = !1,
  303. n.submit()
  304. },
  305. errorCb: function(t) {
  306. var i = n.getLoginErrorCodeFromCaptchaErrorCode(t);
  307. r(function() {
  308. n.loginLayout.isProcessing = !1,
  309. n.setErrorMessage(i, !0)
  310. })
  311. },
  312. closedCb: function() {
  313. n.loginLayout.isProcessing = !1
  314. },
  315. showInModal: !0,
  316. extraValidationParams: {
  317. credentialsType: n.loginFormData.enteredCredentialType,
  318. credentialsValue: n.loginFormData.credentialValue
  319. }
  320. }
  321. }
  322. ,
  323. n.getLoginErrorCodeFromCaptchaErrorCode = function(n) {
  324. switch (n) {
  325. case Roblox.CaptchaConstants.errorCodes.failedToLoadProviderScript:
  326. return l.errorCodes.captchaLoadFailed;
  327. case Roblox.CaptchaConstants.errorCodes.failedToVerify:
  328. return l.errorCodes.captchaVerifyFailed;
  329. default:
  330. return l.errorCodes.captchaUnknownError
  331. }
  332. }
  333. ,
  334. n.setEnteredCredentialType = function(t) {
  335. n.loginFormData.enteredCredentialType = t ? t : n.isEmail(n.loginFormData.credentialValue) ? l.credentialTypes.email : o.isPhoneNumber(n.loginFormData.credentialValue) ? l.credentialTypes.phone : l.credentialTypes.username
  336. }
  337. ,
  338. n.login = function() {
  339. var t = n.isEmail(n.loginFormData.credentialValue), r = o.isPhoneNumber(n.loginFormData.credentialValue), u;
  340. (n.loginFormData.isDefaultLoginRequired || (t ? n.loginFormData.enteredCredentialType = l.credentialTypes.email : r && (n.loginFormData.enteredCredentialType = l.credentialTypes.phone)),
  341. t || r || (n.loginLayout.showErrorBanner = !1),
  342. n.loginParams.isAlwaysCaptchaLoginEnabled && n.loginLayout.forceCaptcha) ? n.activateCaptcha() : (u = {
  343. cvalue: n.loginFormData.credentialValue,
  344. ctype: n.loginFormData.enteredCredentialType,
  345. password: n.loginFormData.password
  346. },
  347. h.login(u).then(function(t) {
  348. n.incrementEphemeralCounter(l.counters.success);
  349. var r = t.data;
  350. n.loginFormData.samlRequest ? n.handleSamlRequest(r) : i.location.href = n.getRedirectUrl(r)
  351. }, function(t) {
  352. n.handleLoginError(t.data, t.status)
  353. }))
  354. }
  355. ,
  356. n.handleLoginError = function(t, i) {
  357. var r, u;
  358. if (i !== l.statusCodes.flooded) {
  359. r = t && t.errors && t.errors.length > 0 && t.errors[0].code;
  360. switch (r) {
  361. case l.errorCodes.captcha:
  362. return n.activateCaptcha(!0),
  363. n.loginLayout.isProcessing = !1,
  364. void n.incrementEphemeralCounter(l.counters.captcha);
  365. case l.errorCodes.passwordResetRequired:
  366. return n.incrementEphemeralCounter(l.counters.passwordResetRequired),
  367. void n.navigateToSecurityNotificationPage()
  368. }
  369. r === l.errorCodes.unverifiedCredentials && n.loginFormData.enteredCredentialType === l.credentialTypes.email ? (n.incrementEphemeralCounter(l.counters.unverifiedAccount),
  370. u = {
  371. credentialType: l.credentialTypes.email,
  372. credentialValue: n.loginFormData.credentialValue,
  373. password: n.loginFormData.password
  374. },
  375. h.canVerifyCredentials(u).then(function(t) {
  376. t && t.data && t.data.canSend ? (n.promptUserToVerifyEmail(),
  377. n.loginLayout.isProcessing = !1) : n.setErrorMessage(r)
  378. }, function() {
  379. n.setErrorMessage(r)
  380. })) : n.setErrorMessage(r, !0)
  381. } else
  382. n.setErrorMessage(l.errorCodes.tooManyAttempts, !0)
  383. }
  384. ,
  385. n.promptUserToVerifyEmail = function() {
  386. f.open({
  387. backdrop: "static",
  388. templateUrl: l.templates.verifyEmail,
  389. controller: l.controllers.verifyEmail,
  390. resolve: {
  391. injectedData: {
  392. context: n.loginParams.context,
  393. email: n.loginFormData.credentialValue,
  394. password: n.loginFormData.password
  395. }
  396. }
  397. }).result.then(angular.noop, angular.noop)
  398. }
  399. ,
  400. n.setErrorMessage = function(t, r) {
  401. var e = t === l.errorCodes.defaultLoginRequired || t === l.errorCodes.unverifiedCredentials, f;
  402. if (n.loginParams.redirectToLoginPageOnError || n.loginParams.redirectToLoginPageWhenUsernameIsRequired && e)
  403. return f = {
  404. errorCode: t,
  405. ctype: n.loginFormData.enteredCredentialType
  406. },
  407. e || (f.username = n.loginFormData.credentialValue),
  408. n.incrementEphemeralCounter(l.counters.redirectToLogin),
  409. void (i.location.href = n.loginFormData.loginPageUrl + a.urlQueryStringPrefix + u(f));
  410. n.loginLayout.isProcessing = !1,
  411. n.loginLayout.error = n.getErrorMessage(t, r)
  412. }
  413. ,
  414. n.getErrorMessage = function(t, i) {
  415. var r, u;
  416. switch (t) {
  417. case l.errorCodes.badCredentials:
  418. return i && n.incrementEphemeralCounter(l.counters.invalidCredentials),
  419. n.getInvalidCredentialsErrorMessage();
  420. case l.errorCodes.accountNotFound:
  421. return i && n.incrementEphemeralCounter(l.counters.accountNotFound),
  422. s.get("Response.AccountNotFound");
  423. case l.errorCodes.noPassword:
  424. return i && n.incrementEphemeralCounter(l.counters.noPassword),
  425. s.get("Response.UseSocialSignOn");
  426. case l.errorCodes.accountIssue:
  427. return i && n.incrementEphemeralCounter(l.counters.accountIssue),
  428. s.get("Response.AccountIssueErrorContactSupport");
  429. case l.errorCodes.tooManyAttempts:
  430. return i && n.incrementEphemeralCounter(l.counters.tooManyAttempts),
  431. s.get("Response.TooManyAttemptsPleaseWait");
  432. case l.errorCodes.defaultLoginRequired:
  433. return i && n.incrementEphemeralCounter(l.counters.defaultLoginRequired),
  434. r = n.getDefaultLoginRequiredErrorMessage(),
  435. n.handleDefaultLoginRequired(r),
  436. null;
  437. case l.errorCodes.unverifiedCredentials:
  438. return i && n.incrementEphemeralCounter(l.counters.unverifiedAccount),
  439. u = n.getUnverifiedCredentialsErrorMessage(),
  440. n.handleDefaultLoginRequired(u),
  441. null;
  442. case l.errorCodes.captchaLoadFailed:
  443. return i && n.incrementEphemeralCounter(l.counters.captchaLoadFailed),
  444. s.get("Response.CaptchaErrorFailedToLoad");
  445. case l.errorCodes.captchaVerifyFailed:
  446. return i && n.incrementEphemeralCounter(l.counters.captchaVerifyFailed),
  447. s.get("Response.CaptchaErrorFailedToVerify");
  448. case l.errorCodes.captchaUnknownError:
  449. return i && n.incrementEphemeralCounter(l.counters.captchaUnknownError),
  450. s.get("Message.UnknownErrorTryAgain");
  451. default:
  452. return i && n.incrementEphemeralCounter(l.counters.unknownError),
  453. s.get("Message.UnknownErrorTryAgain")
  454. }
  455. }
  456. ,
  457. n.activateCaptcha = function(t) {
  458. n.loginLayout.forceCaptcha = t,
  459. n.loginParams.isLoginFunCaptchaEnabled ? (n.funCaptchaSetting.extraValidationParams.credentialsType = n.loginFormData.credentialType,
  460. n.funCaptchaSetting.extraValidationParams.credentialsValue = n.loginFormData.credentialValue,
  461. n.funCaptchaSetting.isActivated = !0) : (Roblox.Captcha.setEndpoint(Roblox.Captcha.types.login, n.loginFormData.captchaApiUrl + "?" + u({
  462. username: n.loginFormData.credentialValue
  463. })),
  464. n.captchaSetting.successCB = function() {
  465. n.submit()
  466. }
  467. ,
  468. n.captchaSetting.isActivated = !0)
  469. }
  470. ,
  471. n.navigateToSecurityNotificationPage = function() {
  472. i.location.href = n.loginFormData.securityNotificationUrl
  473. }
  474. ,
  475. n.handleSamlRequest = function(t) {
  476. var i, f = n.loginFormData.credentialValue, e, r;
  477. t && t.tl ? i = t.tl : t && t.twoStepVerificationData && (i = t.twoStepVerificationData.ticket,
  478. f = t.user.name),
  479. e = i ? l.urls.twoStepVerification + "?" + u({
  480. username: f,
  481. tl: i,
  482. returnUrl: n.loginFormData.returnUrl
  483. }) : n.loginFormData.returnUrl,
  484. r = n.forms.samlRequestForm.$$element,
  485. r.attr("action", e),
  486. r[0].submit()
  487. }
  488. ,
  489. n.getInvalidCredentialsErrorMessage = function() {
  490. switch (n.loginFormData.enteredCredentialType) {
  491. case l.credentialTypes.email:
  492. return s.get("Response.IncorrectEmailOrPassword");
  493. case l.credentialTypes.phone:
  494. return s.get("Response.IncorrectPhoneOrPassword");
  495. default:
  496. return s.get("Response.IncorrectUsernamePassword")
  497. }
  498. }
  499. ,
  500. n.getDefaultLoginRequiredErrorMessage = function() {
  501. switch (n.loginFormData.enteredCredentialType) {
  502. case l.credentialTypes.email:
  503. return s.get("Response.EmailLinkedToMultipleAccountsLoginWithUsername");
  504. case l.credentialTypes.phone:
  505. return s.get("Response.LoginWithUsername");
  506. default:
  507. return ""
  508. }
  509. }
  510. ,
  511. n.getUnverifiedCredentialsErrorMessage = function() {
  512. switch (n.loginFormData.enteredCredentialType) {
  513. case l.credentialTypes.email:
  514. return s.get("Response.UnverifiedEmailLoginWithUsername");
  515. case l.credentialTypes.phone:
  516. return s.get("Response.UnverifiedPhoneLoginWithUsername");
  517. default:
  518. return ""
  519. }
  520. }
  521. ,
  522. n.handleDefaultLoginRequired = function(t) {
  523. n.loginFormData.isDefaultLoginRequired = !0,
  524. n.loginFormData.credentialValue = null,
  525. n.loginFormData.password = null,
  526. t && (n.loginLayout.bannerErrorMessage = t,
  527. n.loginLayout.showErrorBanner = !0)
  528. }
  529. ,
  530. n.getRedirectUrl = function(t) {
  531. var i, r = n.loginFormData.returnUrl, f;
  532. return (t && t.tl ? i = {
  533. username: n.loginFormData.credentialValue,
  534. tl: t.tl
  535. } : t && t.twoStepVerificationData && (i = {
  536. username: t.user.name,
  537. tl: t.twoStepVerificationData.ticket
  538. }),
  539. i) ? (r ? i.returnUrl = r : n.loginParams.redirectToHomePostLogin || (i.returnUrl = n.getCurrentLocation()),
  540. e.getAbsoluteUrl(l.urls.twoStepVerification) + a.urlQueryStringPrefix + u(i)) : t && (t.userId || t.user && t.user.id) ? r ? (f = n.addNewLoginQueryStringToUrl(r),
  541. e.getAbsoluteUrl(f)) : n.loginParams.redirectToHomePostLogin ? n.loginFormData.homeUrl + a.urlQueryStringPrefix + u({
  542. nl: !0
  543. }) : n.getCurrentLocation() : e.getAbsoluteUrl("/")
  544. }
  545. ,
  546. n.getCurrentLocation = function() {
  547. var t = i.location.href
  548. , r = t ? t.indexOf(a.hashSign) : -1;
  549. return r > -1 && (t = t.slice(0, -1 * (t.length - r))),
  550. n.addNewLoginQueryStringToUrl(t)
  551. }
  552. ,
  553. n.addNewLoginQueryStringToUrl = function(n) {
  554. if (!n)
  555. return "/";
  556. var t = n;
  557. return t += n.indexOf(a.urlQueryStringPrefix) > -1 ? a.urlQueryParameterSeparator : a.urlQueryStringPrefix,
  558. t += l.newLoginQueryString
  559. }
  560. ,
  561. n.loginWithFb = function() {
  562. n.sendInteractionClickEvent(l.fbLoginButtonName),
  563. i.location.href = n.loginFormData.redirectToFb
  564. }
  565. ,
  566. n.sendInteractionClickEvent = function(t) {
  567. Roblox.FormEvents && Roblox.FormEvents.SendInteractionClick(n.loginParams.context, t)
  568. }
  569. ,
  570. n.submit = function(t) {
  571. n.clearError(),
  572. n.loginFormData.credentialValue && n.loginFormData.password ? (t && (n.sendInteractionClickEvent(l.loginSubmitButtonName),
  573. n.incrementEphemeralCounter(l.counters.attempt),
  574. n.loginLayout.isFirstSubmit && (n.loginLayout.isFirstSubmit = !1,
  575. n.incrementEphemeralCounter(l.counters.firstAttempt))),
  576. n.loginLayout.isProcessing = !0,
  577. n.loginFormData.enteredCredentialType = l.credentialTypes.username,
  578. n.login()) : n.loginParams.redirectToLoginPageOnError || (n.loginLayout.error = s.get("Message.UsernameAndPasswordRequired"))
  579. }
  580. ,
  581. n.clearError = function() {
  582. n.loginLayout.error = null
  583. }
  584. ,
  585. n.getCredentialPlaceholder = function() {
  586. return n.loginFormData.isDefaultLoginRequired ? s.get("Label.Username") : s.get("Label.UsernameEmailPhone")
  587. }
  588. ,
  589. n.isEmail = function(n) {
  590. return n && n.indexOf(l.atSymbol) > -1
  591. }
  592. ,
  593. n.incrementEphemeralCounter = function(n) {
  594. EventTracker && n && EventTracker.fireEvent(l.counters.prefix + n)
  595. }
  596. }
  597. ]),
  598. login.controller("verifyEmailController", ["$scope", "eventStreamService", "loginService", "loginConstants", "languageResource", "injectedData", function(n, t, i, r, u, f) {
  599. n.layout = {},
  600. n.init = function() {
  601. n.layout.headerText = u.get("Label.EmailNeedsVerification"),
  602. t.sendModalShownEvent(f.context + r.verifyEmailContextSuffix)
  603. }
  604. ,
  605. n.sendVerificationEmail = function() {
  606. n.layout.error = null,
  607. n.layout.isSubmitBusy = !0;
  608. var t = {
  609. credentialType: r.credentialTypes.email,
  610. credentialValue: f.email,
  611. password: f.password
  612. };
  613. i.verifyCredentials(t).then(function() {
  614. n.layout.headerText = u.get("Label.VerificationEmailSent"),
  615. n.layout.emailSent = !0,
  616. n.sendSendVerificationEmailEvent(!0)
  617. }, function(t) {
  618. switch (t && t.data && t.data.errors && t.data.errors.length > 0 && t.data.errors[0].code) {
  619. case r.sendVerificationEmailErrorCodes.tooManyAttempts:
  620. n.layout.error = u.get("Response.TooManyAttemptsPleaseWait");
  621. break;
  622. default:
  623. n.layout.error = u.get("Message.UnknownErrorTryAgain")
  624. }
  625. n.sendSendVerificationEmailEvent(!1)
  626. }).finally(function() {
  627. n.layout.isSubmitBusy = !1
  628. })
  629. }
  630. ,
  631. n.sendSendVerificationEmailEvent = function(n, i) {
  632. t.sendEventWithTarget(t.eventNames.account.sendVerificationEmail, f.context + r.verifyEmailContextSuffix, {
  633. success: n,
  634. msg: i
  635. })
  636. }
  637. ,
  638. n.init()
  639. }
  640. ]);
  641.  
  642. ;//Bundle detector
  643. Roblox && Roblox.BundleDetector && Roblox.BundleDetector.bundleDetected('authAppJs');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement