Blocked a specific email in Squarespace using Code injection JS but I still get email from specific spammer - spam-prevention

I added a code injection in Squarespace to block specific email. If user inputs email, submit button will be disabled. I added recaptcha before and didn't work so I decided to block the specific email. But I still get same spam email from same email used in my contact form. Is there any other way to fix this?
I get the same experience posted here: https://www.signal-arnaques.com/en/scam/view/260546

One possible explanation is that the submit button is not being used to submit the form (it could be submitted programmatically or by other means). You could use JavaScript to add an event listener to the 'submit' event and, within that, prevent the form from being submitted based on your comparison logic. It'd look something like:
var myForm = /* Get the form element. */;
myForm.addEventListener("submit", function(e) {
var emailAddress = /* Get the value of the field */;
if (emailAddress == "info#domainworld.com") {
e.preventDefault();
}
});
Of course, because it's client-side JavaScript, it's entirely possible that the bot could work around this as well.

Related

How to always validate an angular json schema form?

I am using angular-schema-form, and ran into a problem that when I load a schema and a form from a server using REST, the validation sometimes did not kick in. I could post a schema even though some fields were required.
How can I always be sure that the required fields in the form has to be filled in by the user before posting?
I found that using $scope.$broadcast('schemaFormValidate'); before submitting the form works (from the docs).
$scope.onSubmit = function(form) {
// First we broadcast an event so all fields validate themselves
$scope.$broadcast('schemaFormValidate');
// Then we check if the form is valid
if (form.$valid) {
// ... do whatever you need to do with your data.
}
}
However, we can not disable any buttons beforehand.
#John you can set a value in your model that is part of a display condition. That allows you to hide the buttons on submit and then re-enable them when you are ready for the user to submit the form again for any reason.

Angular 1.3, required, form.$invalid, and saved passwords

I have a login form that has a username and password. Both are required to trigger other form elements.
However, in chrome if the password is saved, form.$invalid returns true and the digest doesn't re-run when the saved information gets added. Is there any way to require fields being saved and set by the browser and have angular re-check form.$valid?
Surprisingly, I was facing a similar problem some time back. The trick is to get the browser to fire input events for things that may have been filled in by chrome autofill (but haven't updated).
If you have a submit or click handler for the form submission, you can trigger the input event on all your inputs so that angular will pick up the changes by autofill.
You may do something like this
var app = angular.module('app',[]);
app.run(function() {
// Trigger input event on change to fix auto-complete
$('input, select').on('change',function() { $(this).trigger('input'); });
});
to fire input event on all inputs.
Here's the original github issue related to your problem.

Best way to save/update a resource with ($watch or save button, etc..)

Currently I run into the following problem,
we are working on a form heavy application and wanted a good user experience so we tried to stop have a save / update button everywhere.
Currently we try to $watch every Form Change, but this won't work correctly since it updates the scope when the model gets updated which causing problems on Decimal / Money Values.
What would you prefer? Still the messy save button or maybe something like Gmail did?
What are good methods to do this without save buttons.
/* EDITED */
Currently we use this method to update our form.
It first copys the scope in an object and checks if it is the same than the object that is set after the date got pulled.
$scope.$watch('task', function(scope) {
console.log($scope.updateForm);
scopeObject = angular.copy(scope);
if(scope !== undefined) {
if(!(_.isEqual(scopeObject, mainObject))){
//scope_copy.request_date = $filter('date')(new Date(scope.request_date), 'fullDate');
console.log('update');
scope.$update({pk: $routeParams.taskId}, function() {
scope.request_date = $filter('date')(scope.request_date);
mainObject = angular.copy(scope);
});
mainObject = angular.copy(scope);
}
}
}, true);
currently i think this code is somehow messy since it can't update decimal numbers.
but currently i don't have a better solution. (i don't want to use a Button to submit the form, it should be done interactivly).

Intercepting all clicks with AngularJS to warn user of unsaved data

I have a lengthy form customers will need to fill out. If they click a link on a page, it will navigate away from that Controller and they will lose any data they may have already input.
If I can determine the form has not yet been saved, how can I intercept any click to the links on the page so I can ask the user if they want to save their form first?
No code yet- sorry. Many thanks.
I've written an angularjs directive that you can apply to any form that will automatically watch for changes and message the user if they reload the page or navigate away. #see https://github.com/facultymatt/angular-unsavedChanges
Hopefully you find this directive useful!
sorry for the late answer but mabye someone stumbles upon this and finds it useful. I have encountered the same problem and at the beginning i tryed to use the ng-dirty class applyed to the form element but because i had some custom controls the ng-bind won't be applyed when i changed some fields.
The best way i found so far is to detect when the model is changed with the use of $locationChangeStart event.
$scope.$on('$locationChangeStart', function (event, next, current) {
//we are about to leave the page so it's time to see if the form was modified by the user
if (!$scope.isFormClean())
{
event.preventDefault();
}
});

Hide Email on Lead Page Layout in Salesforce

I am looking at hiding Email on Leads Page Layout.
I am including it in a section already with a visualforce page but PageLayout doesn't detect that and still requires it to be on the layout.
Is there a way to remove it from the PageLayout?
I have read that you can edit a picklist but didn't find any solid examples of doing that. I also read about Field Level Accessibility but I don't think that's the way to go since everyone is part of the same role and I am only excluding the detail based off if you're the owner. I have also tried javascript but since my visualforce page is loaded in an iframe I can't access the parent document of the iframe to be able to hide or remove the value from email while viewing not as the owner.
Any thoughts would be appreciated.
Try hiding the field with JavaScript stored in a Custom Button. In the On-Click JavaScript for the button, you can include code that will be run on page load by jQuery that hides the Email field. You can then hide the actual button as well. Very much a hack approach, but it should work.
Here's some code to put in the On-Click JavaScript button (modified from Daniel Llewellyn's blog post and mgsmith's force2b blog post). Hopefully this should get you jump-started. I didn't include any code on how to hide the Email field, but you said you were already trying it through your Visualforce page, so I figured I'd leave that part to you. Cheers!
var interval;
//The main function that does all the work
function appendScript() {
// Include core jQuery library by injecting it into the DOM
var script= document.createElement('script');
script.type= 'text/javascript';
script.src= 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js';
head.appendChild(script);
// It takes a second to load, so put in a delay
// (we don't want to try and reference the script
// before it is actually loaded, so we store the interval
// in a global variable, and set up an interval.
// this interval dealio. This will keep running
// until jQuery has been found to be loaded and then
//clears the interval so it doesn't keep running.
interval=self.setInterval(function(){
//Check to see if jQuery has loaded
if(jQuery) {
//if jQuery has loaded, clear the interval
window.clearInterval(interval);
// Hide the Email field
// Hide the custom button
var btnName = 'buttonName';
try{
var buttons = parent.document.getElementsByName(btnName);
for (var i=0; i < buttons.length; i++) {
buttons[i].className="btnDisabled ";
buttons[i].disabled=true;
buttons[i].type='hidden';
}
} catch(e) {
// var ee = e.message || 0; alert('Error: \n\n'+e+'\n'+ee);
}
}
}, 300);
}
appendScript();

Resources