Created
August 11, 2019 20:19
-
-
Save bitnom/9add2b99c8bc73abd2faf0ec697000f7 to your computer and use it in GitHub Desktop.
gun doesn't create user in alias check
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
$('#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