/* NOTE!! If you change this file, you should update AssemblyInfo.vb in the My Project section of this project. Update the node version number. Increment by 1. This will ensure the client will download an updated version of this script file! */ Sd.Login = Class.create(); Sd.Login.prototype = { } Sd.Login.url = 'https://services.stardock.net/login/'; Sd.Login.Params = function() { return Sys.Serialization.JavaScriptSerializer.deserialize('{"Username":"","Password":"","Guid":"","Result":0,"ReturnAddress":"","Data":0,"RememberLogin":true,"OriginHost":"","AccountID":0}'); } Sd.Login.Attempt = function() { var user = $id('_TextUser'); var pass = $id('_TextPass'); var hidden = $id('_LoginParams'); var params = new Sd.Login.Params(); var m = ''; var userValid = Sd.Validate.requireValue(user); var passValid = Sd.Validate.requireValue(pass); if(userValid == false) m = '\tPlease enter a Username.'; if(passValid == false){ if(m != ''){ m += '\n'; }; m += '\tPlease enter a Password.'; } if(m != ''){ alert('Please correct the following before attempting to Log In\n\n' + m); return false; } params.Data = 1; params.Username = user.value; params.Password = pass.value; params.OriginHost = location.hostname; if(Sd.Login.endsWith(location.toString(), Sd.Login.escape('+login')) == true && document.referrer && document.referrer != '') params.ReturnAddress = document.referrer; else params.ReturnAddress = location.toString(); var data = Sys.Serialization.JavaScriptSerializer.serialize(params); hidden.value = data; if(!theForm) return false; theForm.method = 'POST'; theForm.action = Sd.Login.url + 'Login.axd'; theForm.submit(); return false; } Sd.Login.handleKeydown = function(e) { if(!Sd.Common.catchEnter(e)) { Sd.Login.Attempt(); return false; } return true; } Sd.Login.endsWith = function (str, s){ var reg = new RegExp(s + "$"); return reg.test(str); }; Sd.Login.escape = function(s) { var specials = ['/', '.', '*', '+', '?', '|','(', ')', '[', ']', '{', '}', '\\']; var r = new RegExp('(\\' + specials.join('|\\') + ')', 'g'); return s.replace(r, '\\$1'); };