Created
March 27, 2016 15:46
-
-
Save adityamenon/88e76a42f4b28b6a8771 to your computer and use it in GitHub Desktop.
Suggested signup code on deepstream.io
This file contains 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
$scope.execSignup = function () { | |
var fullName = $scope.signupForm.FullName, | |
username = $scope.signupForm.Username, | |
password = $scope.signupForm.Password; | |
dsanon.on('error', function (err) { | |
console.log("Anonymous Deepstream connection error: ", err); | |
}); | |
var newUserRecord = dsanon.record.getRecord("user/"+username) | |
newUserRecord.whenReady(_ => { | |
newUserRecord.set({ | |
fullName: fullName, | |
username: username, | |
password: password, // This is a PoC, there are a LOT of other security concerns as well - needs more architecting overall | |
friends: [] | |
}); | |
newUserRecord.discard(); | |
var newCoordsRecord = dsanon.record.getRecord("coords/"+username); | |
newCoordsRecord.whenReady(_ => { | |
newCoordsRecord.set({ | |
latitude: null, | |
longitude: null | |
}); | |
newCoordsRecord.discard(); | |
$ionicPopup.alert({ | |
"template": "Registration completed! Please login now." | |
}).then(function () { | |
$scope.registerModal.hide(); | |
$scope.loginModal.show(); | |
}); | |
}); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment