UNPKG

@sexycoders/libauth.js

Version:

A full service for asymetric passwordless authentication.

38 lines (36 loc) 1.35 kB
function Register(k) { var data=new Object(); data.email=($('form').serializeArray()[0].value); data.password=($('form').serializeArray()[1].value); var json_send=new Object(); json_send.command="register_user"; json_send.user=new Object(); json_send.user.id=data.email; console.log("Json Is: "+JSON.stringify(json_send)); json_send=btoa(JSON.stringify(json_send)); window.__auth_system.user=data.email; //var ssh_pass=new Object(); //ssh_pass.password=data.password; //ssh_create(ssh_pass); var ssh_pass=new Object(); ssh_pass.password=data.password; ssh_create(ssh_pass,false); $.ajax({ type: 'POST', headers: {"Access-Control-Allow-Origin":"auth-serve.localhost"}, url: window.__auth_system.auth_server, data: json_send, success: function(response) { console.log("server response: "+atob(response)); var R=JSON.parse(atob(response)); if(R.message=="verify_email") { window.alert("A verification code has been sent to your email!\nPlease copy that into the box to complete your registration!"); } }, async:false }); };