$(function(){$(".domainVerificationButton").click(function(n){var i;n.preventDefault();var t=$(this).attr("data-verification-service"),e=t=="sendverificationemail",r=t=="verifyemailtoken",o=$("#WebsiteToken").val(),u=$("#EmailToken").val(),s="/api/domainverification/"+t,f={Token:r?u:o};if($(this).next().css("display","inline-block"),$(".alert").hide(),e){if(i=$("input[name=VerificationEmail]:checked").val(),!IsEmailValid(i)){$("#domainVerificationError").text("No email selected").show();$("#verificationMessage").text("You need to select an email address before a verification can be sent to it!");$(".fa-loader").hide();$("#verificationResultModal").modal("show");return}f.Email=i}else if(r&&u==""){$("#domainVerificationError").text("No token entered").show();$("#verificationMessage").text("You can't verify your token until you actually enter it! Try it again.");$(".fa-loader").hide();return}$.post(s,f).done(function(n){var i=n.Result;i=="VerificationSuccessful"?($("#domainVerificationSuccess").text("Verification successful!").show(),t=="verifyemailtoken"?($("#verificationMessage").text(""),$("#emailTokenVerification").hide()):t=="verifytxtrecord"?$("#verificationMessage").text("The correct TXT record was found and the domain has been verified. You can remove the record from the domain now if you'd like and use one of the options below to retrieve the breached accounts for the domain."):t=="verifymetatag"?$("#verificationMessage").text("The correct meta tag was found and the domain has been verified. You can remove the tag now if you'd like and use one of the options below to retrieve the breached accounts for the domain."):t=="verifyfileupload"&&$("#verificationMessage").text("The file was found with the correct content and the domain has been verified. You can remove the file now if you'd like and use one of the options below to retrieve the breached accounts for the domain."),$("#domainSearchRetrieval").show()):i=="AlreadyVerified"?($("#domainVerificationSuccess").text("Domain already verified").show(),$("#verificationMessage").text("You've already verified this domain. You can use one of the options below to retrieve the breached accounts for the domain."),$("#domainSearchRetrieval").show()):i=="InvalidToken"?($("#domainVerificationError").text("Invalid token").show(),$("#verificationMessage").text("That doesn't look like a valid token, check you've got it correct then give it another go.")):i=="TxtRecordNotFound"?($("#domainVerificationError").text("TXT record not found").show(),$("#verificationMessage").text("The TXT record was not found on the domain. It can take some time for DNS to propagate, leave this page open and hit the verify button again a little later if you're confident the record is correct.")):i=="TxtRecordCouldNotBeRetrieved"?($("#domainVerificationError").text("TXT record couldn't be retrieved").show(),$("#verificationMessage").text("You can leave this page open and hit the verify button again a little later or alternatively, use one of the other verification methods.")):i=="DisallowedEmail"?($("#domainVerificationError").text("Disallowed email").show(),$("#verificationMessage").text("That email address is not on either the domain registration record or one of the default ones you're allowed to use for verification.")):i=="InvalidEmail"?($("#domainVerificationError").text("Invalid email").show(),$("#verificationMessage").text("Looks like that email address couldn't be sent to, you might need to try one of the other means of verification.")):i=="TooManyVerificationEmailsSent"?($("#domainVerificationError").text("Too many verification emails").show(),$("#verificationMessage").text("Looks like you've sent too many verification emails, you'll need to either choose another means of verification or go back and begin the domain search again.")):i=="VerificationEmailSent"?($("#domainVerificationInProgress").text("Verification token sent").show(),$("#verificationMessage").text("An email containing a verification token has been sent off to the address you chose, just copy and paste it into the text box below and you'll be able to perform the domain search right after that."),$("#emailTokenVerification").show()):i=="TokenNotPresentInMetaTag"?($("#domainVerificationError").text("Meta tag not found").show(),$("#verificationMessage").text("Are you sure it's on the site at the root of the domain and publicly accessible? You can close this dialogue and hit the \"verify\" button again to give it another go when you're ready.")):i=="CouldNotRetrieveUri"?($("#domainVerificationError").text("No response from domain").show(),$("#verificationMessage").text('Are you sure the domain is correct and publicly accessible? You can close this dialogue and hit the "verify" button again to give it another go if you\'d like.')):i=="TokenNotPresentInFileUpload"?($("#domainVerificationError").text("The file was not found").show(),$("#verificationMessage").text("Are you sure it's on the site at the root of the domain with the correct content and is publicly accessible? You can close this dialogue and hit the \"verify\" button again to give it another go when you're ready.")):i=="ExtraDataInFileUpload"?($("#domainVerificationError").text("The file has other data in it").show(),$("#verificationMessage").text("The file with the correct content was found, but there's other data in it too. Make sure only the text provided in the instructions is present in the file. You can close this dialogue and hit the \"verify\" button again to give it another go when you're ready.")):i=="RateLimitHit"&&($("#domainVerificationError").text("Whoa - slow down there!").show(),$("#verificationMessage").text("Too much verifying will make you dizzy. Wait a few seconds then try that again."))}).fail(function(){$("#domainVerificationError").text("Oh no, catastrophic failure!").show();$("#verificationMessage").hide()}).always(function(){$(".fa-loader").hide();$("#verificationResultModal").modal("show")})});$("#verificationResultModal").on("hidden.bs.modal",function(){$("#emailTokenVerification").hide()});$("#SubscribeToNotifications").click(function(){$(this).is(":checked")?$("#notificationEmailRow").show():$("#notificationEmailRow").hide()})})