diff options
| author | jmoenig <jens@moenig.org> | 2013-05-06 19:46:17 +0200 |
|---|---|---|
| committer | jmoenig <jens@moenig.org> | 2013-05-06 19:46:17 +0200 |
| commit | b5ddbfbc7558dbdf2c7291598dd9d8face1fa229 (patch) | |
| tree | f4dbafec7d24a62e17638e93d4348ee96e7c8167 /cloud.js | |
| parent | f22338b3a962c9008f14ac6997ce64f4b28cdd8f (diff) | |
| download | snap-byow-b5ddbfbc7558dbdf2c7291598dd9d8face1fa229.tar.gz snap-byow-b5ddbfbc7558dbdf2c7291598dd9d8face1fa229.zip | |
Reset Password Feature
(front end only)
Diffstat (limited to 'cloud.js')
| -rw-r--r-- | cloud.js | 60 |
1 files changed, 58 insertions, 2 deletions
@@ -29,7 +29,7 @@ /*global modules, IDE_Morph, SnapSerializer, hex_sha512, alert, nop*/ -modules.cloud = '2013-April-19'; +modules.cloud = '2013-May-06'; // Global stuff @@ -37,7 +37,7 @@ var Cloud; var SnapCloud = new Cloud( 'https://snapcloud.miosoft.com/miocon/app/login?_app=SnapCloud' - //'192.168.2.108:8087/miocon/app/login?_app=SnapCloud' + //'192.168.2.110:8087/miocon/app/login?_app=SnapCloud' //'192.168.186.167:8087/miocon/app/login?_app=SnapCloud' // 'localhost/miocon/app/login?_app=SnapCloud' ); @@ -178,6 +178,62 @@ Cloud.prototype.getPublicProject = function ( } }; +Cloud.prototype.resetPassword = function ( + username, + email, + callBack, + errorCall +) { + // both callBack and errorCall are two-argument functions + var request = new XMLHttpRequest(), + myself = this; + try { + request.open( + "GET", + (this.hasProtocol() ? '' : 'http://') + + this.url + 'ResetPW' + + '&Username=' + + encodeURIComponent(username) + + '&Email=' + + email, + true + ); + request.setRequestHeader( + "Content-Type", + "application/x-www-form-urlencoded" + ); + request.withCredentials = true; + request.onreadystatechange = function () { + if (request.readyState === 4) { + if (request.responseText) { + if (request.responseText.indexOf('ERROR') === 0) { + errorCall.call( + this, + request.responseText, + 'Reset Password' + ); + } else { + callBack.call( + null, + request.responseText, + 'Reset Password' + ); + } + } else { + errorCall.call( + null, + myself.url + 'ResetPW', + 'could not connect to:' + ); + } + } + }; + request.send(null); + } catch (err) { + errorCall.call(this, err.toString(), 'Snap!Cloud'); + } +}; + Cloud.prototype.connect = function ( callBack, errorCall |
