fix bug generated by gemini
This commit is contained in:
		| @@ -593,8 +593,9 @@ apx.apxauth.createIdentity = async (id, alias, recoemail, passphrase = "") => { | ||||
|       if (err.response && err.response.status == 404) { | ||||
|         // alias does not exist create it is possible | ||||
|         const keys = await apx.apxauth.generateKey(alias, passphrase); | ||||
|         apx.data.tmpauth = { keys, recoemail, passphrase }; | ||||
|         //console.log(apx.data.tmpauth); | ||||
|         apx.data.tmpauth = { ...keys, recoemail, passphrase }; | ||||
|         apx.save(); | ||||
|         console.log(apx.data.tmpauth); | ||||
|         ["publickey", "privatekey"].forEach((k) => { | ||||
|           console.log(`${id} button.signup${k}`); | ||||
|           const btn = document.querySelector(`#${id} button.signup${k}`); | ||||
| @@ -649,13 +650,16 @@ apx.apxauth.test = () => { | ||||
| }; | ||||
| apx.apxauth.registerIdentity = async (id, trustedtribe) => { | ||||
|   const authid = document.getElementById(id); | ||||
|   console.log("trustedtribe",trustedtribe) | ||||
|   // trustedtribe boolean | ||||
|   //previously store in apx.data.tmpauth={keys:{alias,privatekey,publickey},recoemail,passphrase} | ||||
|    | ||||
|   console.log("tmpauth:",apx.data.tmpauth) | ||||
|   const setheaders = await apx.apxauth.setheadersauth( | ||||
|     apx.data.tmpauth.keys.alias, | ||||
|     apx.data.tmpauth.alias, | ||||
|     apx.data.tmpauth.passphrase, | ||||
|     apx.data.tmpauth.keys.publickey, | ||||
|     apx.data.tmpauth.keys.privatekey, | ||||
|     apx.data.tmpauth.publickey, | ||||
|     apx.data.tmpauth.privatekey, | ||||
|     false | ||||
|   ); | ||||
|   if (setheaders.status != 200) { | ||||
| @@ -664,18 +668,15 @@ apx.apxauth.registerIdentity = async (id, trustedtribe) => { | ||||
|     // add withpublickeyforcreate to check isAuthenticated alias does not already exist | ||||
|  | ||||
|     const data = {}; | ||||
|     data.alias = apx.data.tmpauth.keys.alias; | ||||
|     data.publickey = apx.data.tmpauth.keys.publickey; | ||||
|     const validator= new Checkjson({properties:{email:{type:"string",format:"email"}}}); | ||||
|     if ( | ||||
|       apx.data.tmpauth.recoemail && | ||||
|       validator.verify({email:apx.data.tmpauth.recoemail}) | ||||
|     ) { | ||||
|       data.passphrase = apx.data.tmpauth.keyspassphrase; | ||||
|       data.privatekey = apx.data.tmpauth.keysprivatekey; | ||||
|     data.alias = apx.data.tmpauth.alias; | ||||
|     data.publickey = apx.data.tmpauth.publickey; | ||||
|     if (apx.data.tmpauth.recoemail) { | ||||
|       data.passphrase = apx.data.tmpauth.passphrase; | ||||
|       data.privatekey = apx.data.tmpauth.privatekey; | ||||
|       data.email = apx.data.tmpauth.recoemail; | ||||
|     } | ||||
|     data.trustedtribe = trustedtribe; | ||||
|     console.log(data) | ||||
|     axios | ||||
|       .post(`/api/apxtri/pagans`, data, { headers: apx.data.headers }) | ||||
|       .then((reppagan) => { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user