Created
February 10, 2012 20:43
-
-
Save technovangelist/1792713 to your computer and use it in GitHub Desktop.
Get Secret Info From SquareSpace and Store in Adobe Air Local Store
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#b64_sha1 library used in this code is Base64 encode / decode from http://www.webtoolkit.info/ | |
localStoreset= (objectName, newobject) -> | |
bytes=new air.ByteArray() | |
bytes.writeUTFBytes(newobject) | |
air.EncryptedLocalStore.setItem(objectName, bytes) | |
getSecretInfoFromSS = (user,pass)-> | |
datatext = "encryptedPassword=#{encodeURIComponent(b64_sha1(pass))}&loginStyle=regular&SS_CHAIN_TO_ACTION=http%3A%2F%2WebpageToRedirectToWithSecrets%2Frelogin=true&username=#{user}" | |
$.ajax | |
type:"POST" | |
url:"http://SquareSpaceSiteWhereInfoSits/process/Login" | |
data: datatext | |
success: (data) -> | |
encRawJSON=$(data).find(DivTagSurroundingYourSecret).text() | |
if encRawJSON isnt "" | |
rawJSON = Base64.decode(encRawJSON) | |
JSONObject=$.parseJSON(rawJSON) | |
localStoreSet("username",user) | |
localStoreSet("passhash",b64_sha1(pass)) | |
localStoreSet("secretuser",JSONObject.secret1) | |
localStoreSet("secretpassword",JSONObject.secret2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment