Skip to content

Instantly share code, notes, and snippets.

@bitnom
Created August 11, 2019 20:19
Show Gist options
  • Save bitnom/9add2b99c8bc73abd2faf0ec697000f7 to your computer and use it in GitHub Desktop.
Save bitnom/9add2b99c8bc73abd2faf0ec697000f7 to your computer and use it in GitHub Desktop.
gun doesn't create user in alias check
$('#up').on('click', function(e) {
e.preventDefault();
let aliasIn = $('#alias').val()
let passIn = $('#pass').val()
gun.get("~@" + aliasIn).once(function (uAlias) {
if (uAlias === undefined) {
console.log("alias undefined, registering.")
user.create($('#alias').val(), $('#pass').val(), function (ack) {
console.log("create user ack: " + ack)
user.auth($('#alias').val(), $('#pass').val());
});
} else {
console.log("Error: User " + alias + " already exists. Cannot register.")
}
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment