fix bug generated by gemini

This commit is contained in:
2025-08-25 09:00:02 +02:00
parent be706a81ab
commit 5828a6ee48

View File

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