Skip to content

Instantly share code, notes, and snippets.

@adityamenon
Created March 27, 2016 15:46
Show Gist options
  • Save adityamenon/88e76a42f4b28b6a8771 to your computer and use it in GitHub Desktop.
Save adityamenon/88e76a42f4b28b6a8771 to your computer and use it in GitHub Desktop.
Suggested signup code on deepstream.io
$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