Claim address page security improvements
-Removed the ability to claim an address that has 0 transactions -The "Claim" button is now disabled after submitting to help prevent double submissions
This commit is contained in:
+36
-29
@@ -460,35 +460,42 @@ module.exports = {
|
||||
},
|
||||
|
||||
update_claim_name: function(hash, claim_name, cb) {
|
||||
// check if the claim name is being removed
|
||||
if (claim_name == null || claim_name == '') {
|
||||
// remove the claim name
|
||||
ClaimAddress.findOneAndDelete({a_id: hash}).then(() => {
|
||||
// run processes after the claim name has been updated
|
||||
after_update_claim_name(hash, claim_name, function() {
|
||||
return cb('');
|
||||
});
|
||||
}).catch((err) => {
|
||||
console.log(err);
|
||||
return cb(err);
|
||||
});
|
||||
} else {
|
||||
// add or update the claim name
|
||||
ClaimAddress.updateOne({a_id: hash}, {
|
||||
a_id: hash,
|
||||
claim_name: claim_name
|
||||
}, {
|
||||
upsert: true
|
||||
}).then(() => {
|
||||
// run processes after the claim name has been updated
|
||||
after_update_claim_name(hash, claim_name, function() {
|
||||
return cb('');
|
||||
});
|
||||
}).catch((err) => {
|
||||
console.log(err);
|
||||
return cb(err);
|
||||
});
|
||||
}
|
||||
// check if the address has received coins before by looking up the address in the local database
|
||||
module.exports.get_address(hash, false, function(address) {
|
||||
// check if the address was found in the local database
|
||||
if (address) {
|
||||
// check if the claim name is being removed
|
||||
if (claim_name == null || claim_name == '') {
|
||||
// remove the claim name
|
||||
ClaimAddress.findOneAndDelete({a_id: hash}).then(() => {
|
||||
// run processes after the claim name has been updated
|
||||
after_update_claim_name(hash, claim_name, function() {
|
||||
return cb('');
|
||||
});
|
||||
}).catch((err) => {
|
||||
console.log(err);
|
||||
return cb(err);
|
||||
});
|
||||
} else {
|
||||
// add or update the claim name
|
||||
ClaimAddress.updateOne({a_id: hash}, {
|
||||
a_id: hash,
|
||||
claim_name: claim_name
|
||||
}, {
|
||||
upsert: true
|
||||
}).then(() => {
|
||||
// run processes after the claim name has been updated
|
||||
after_update_claim_name(hash, claim_name, function() {
|
||||
return cb('');
|
||||
});
|
||||
}).catch((err) => {
|
||||
console.log(err);
|
||||
return cb(err);
|
||||
});
|
||||
}
|
||||
} else
|
||||
return cb('no_address');
|
||||
});
|
||||
},
|
||||
|
||||
update_richlist_claim_name: function(hash, claim_name, cb) {
|
||||
|
||||
Reference in New Issue
Block a user