signup.29d92173b6e2c87faf59.js 1.78 KB
(window.webpackJsonp=window.webpackJsonp||[]).push([["4122"],{mHNQ:function(e,r){angular.module("fr.same",[]).directive("frSame",function(){return{require:"ngModel",scope:{same:"=frSame"},link:function(e,r,t,o){o.$validators.same=function(r){return r==e.same},e.$watch("same",function(){o.$validate()})}}})},u7Ot:function(e,r,t){"use strict";t.r(r);t("mHNQ");var o=t("m/V4");function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}angular.module("footyroom").requires.push("fr.same",o.a),angular.module("footyroom").controller("RegistrationController",["$scope","$http","$q","$window",function(e,r,t,o){e.$watch("registrationForm",function(){e.user={fbtoken:$.QueryString.fbtoken},e.registrationForm.username.$asyncValidators.available=function(o,n){return e.registrationForm.username.$isEmpty(o)?t.when():r.get("/signup/check-username",{params:{username:o}}).then(function(e){if("available"!=e.data)throw"FootyRoom: this username is not valid."})}}),e.submit=function(){!function(){if(e.registrationForm.$invalid)return;$(".signup-well").litelay({spinner:!0}),delete e.serverErrors,e.user.gRecaptchaResponse=grecaptcha.getResponse(),r.post("/signup",e.user).then(function(r){if(!r.data.ok)throw{};e.user.fbtoken?o.location="/profile/settings":o.location="/signup/done"}).catch(function(r){"object"===n(r.data)?_.each(r.data,function(r,t){if("server"===t||"errors"===t)return e.serverErrors=r;_.each(r,function(r){e.registrationForm[t]&&e.registrationForm[t].$setValidity(r,!1)})}):e.serverErrors=["Some unexpected error happened. Try again later."],$(".signup-well").litelay({off:!0}),grecaptcha.reset()})}()}}])}},[["u7Ot","d41d","249e","9ba4"]]]);