summaryrefslogtreecommitdiff
path: root/cloud.js
diff options
context:
space:
mode:
authorjmoenig <jens@moenig.org>2013-05-06 19:46:17 +0200
committerjmoenig <jens@moenig.org>2013-05-06 19:46:17 +0200
commitb5ddbfbc7558dbdf2c7291598dd9d8face1fa229 (patch)
treef4dbafec7d24a62e17638e93d4348ee96e7c8167 /cloud.js
parentf22338b3a962c9008f14ac6997ce64f4b28cdd8f (diff)
downloadsnap-yow-b5ddbfbc7558dbdf2c7291598dd9d8face1fa229.tar.gz
snap-yow-b5ddbfbc7558dbdf2c7291598dd9d8face1fa229.zip
Reset Password Feature
(front end only)
Diffstat (limited to 'cloud.js')
-rw-r--r--cloud.js60
1 files changed, 58 insertions, 2 deletions
diff --git a/cloud.js b/cloud.js
index 9245286..f3396d8 100644
--- a/cloud.js
+++ b/cloud.js
@@ -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