New Google reCaptcha: How to change text "I'm not a robot" - captcha

I've installed the latest Google reCaptcha tool on our yoga website. Now the users are confused about the text "I'm not a robot" that appears next to the checkbox.
Most of our users do not know what the word "robot" means in this context and they think the form is broken. They also feel less safe using our form as it is weird to see the word "robot" on a yoga website.
How do I change the text "I'm not a robot" to something else that the users understand?
The docs appear silent on this point...
Also, it seems like the contents of the reRecaptcha are completely locked down via remote JS and CSS. I've unsuccessfully tried using the following javascript to change the text for Googles recaptcha-anchor-label:
<script type="text/javascript">
$(document).ready(function () {
$("#recaptcha-anchor-label").text("Something different.");
});
</script>

It is possible to change "I'm not a robot" in Google Recaptcha into a different language by using language codes for the hl script parameter.
This is how you force Spanish, for example:
<script type="text/javascript" src="https://www.google.com/recaptcha/api.js?hl=es">
Source: Google ReCaptcha Docs

It is currently impossible using their tool. If you want to use a different method of stopping robots: Uninstall reCaptcha, and use something you have control over, maybe a simple randomized question and answer that pertains to yoga.

You cannot change that specific text because it belongs to a third party iframe, though there is a workaround that fulfils exactly what the OP is asking for.
You can append a new div on the parent div you can control, aligning and overlapping it on the label text, considering the Google Captcha has always a fixed size. Therefore, according to documentation, considering you may have the main Captcha div on your code with class="g-recaptcha", you simply do:
$('.g-recaptcha').append('<div id="new_label"></div>');
$('#new_label').text("My own text");
$('#new_label').css({"position":"absolute", "width":"160px", "top":"27px", "left":"53px", "background-color":"#f9f9f9"});
it works :)

This is not possible because the Same Origin Policy prohibits any script (that's on your site) trying to access an iframe (the captcha) that has another origin (Google server).
We should have no problem running the code below if we own both servers :)
$( ".g-recaptcha > div > div > iframe" ).contents().find( "#recaptcha-anchor-label" ).text('Custom Text');

Coming back to this old question - there is now an invisible version of the reCAPTCHA widget that allows you to design the UI on your own. You can bind the execution of the challenge to a button you've created or invoke it programmatically in the background.
I'm citing the docs page here for quick reference, you can read more about this here.
The necessary attributes are a class name 'g-recaptcha', your site key in the data-sitekey attribute, and the name of a JavaScript callback to handle completion of the captcha in the data-callback attribute.
Head:
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<script>
function onSubmit(token) {
document.getElementById("demo-form").submit();
}
</script>
Body:
<form id='demo-form' action="?" method="POST">
<button class="g-recaptcha" data-sitekey="your_site_key" data-callck='onSubmit'>Submit</button>
<br/>
</form>

I used client side captcha here is my code.its working fine for my portal.
this.canvas = document.getElementById( 'myCanvas' ) as HTMLCanvasElement;
var context = this.canvas.getContext( '2d' );
context.clearRect( 0, 0, this.canvas.width, this.canvas.height );
var alpha = [];
alpha = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H','J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'm', 'n', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'2', '3', '4', '5', '6', '7', '8', '9'];
var i;
for ( i = 0; i < 6; i++ ) {
var a = alpha[Math.floor( Math.random() * alpha.length )];
var b = alpha[Math.floor( Math.random() * alpha.length )];
var c = alpha[Math.floor( Math.random() * alpha.length )];
var d = alpha[Math.floor( Math.random() * alpha.length )];
var e = alpha[Math.floor( Math.random() * alpha.length )];
var f = alpha[Math.floor( Math.random() * alpha.length )];
var g = alpha[Math.floor( Math.random() * alpha.length )];
}
this.captchaCode = a + ' ' + b + ' ' + ' ' + c + ' ' + d + ' ' + e + ' ' + f + ' ' + g;
var ctext = this.captchaCode;
this.loginForm.controls['captcha'].setValue( this.captchaCode.replace( /\s/g, "" ) );
Here is I am drawing canvas image
/*Text to image captcha */
var imageObj = new Image();
imageObj.onload = function() {
context.drawImage( imageObj, 0, 0 );
context.font = "24px arial";
context.fillText( ctext, 84, 32 );
};
imageObj.src = 'assets/modules/dummy-assets/common/img/captcha2.jpg';

Related

Undefined variable in FPDF. help me. mysqli

why Notice: Undefined variable: datanya?
can you fixed? this is my code:
how do i fix it.
require("fpdf.php");
$konek=mysqli_connect("localhost","root","","rollab");
$kode=$_GET['kode'];
$query=mysqli_query($konek,"select*from wp_jadwal where id_jadwal='.$kode.'");
$datanya =mysqli_fetch_assoc($query);
class myPDF extends FPDF{
function headerPro(){
$this->Ln(13);
$this->Cell(40,5,$datanya["tanggalpemutaran"],0,0,'L');
$this->Ln();
}
}
You should check out this FAQ of FPDF. It's for the default Header/Footer methods but it's the same issue:
5. I try to display a variable in the Header method but nothing prints.
You have to use the global keyword to access global variables, for example:
function Header()
{
global $title;
$this->SetFont('Arial', 'B', 15);
$this->Cell(0, 10, $title, 1, 1, 'C');
}
$title = 'My title';
Alternatively, you can use an object property:
function Header()
{
$this->SetFont('Arial', 'B', 15);
$this->Cell(0, 10, $this->title, 1, 1, 'C');
}
$pdf->title = 'My title';

PathGraphics not working in real-time or runtime generated

Have simple app using Cesium. I have basic entity with ellipse graphics, moving around, and I need to display its path, using PathGraphics, but it doesn't seem to work for me.
Here's code sample.
const position = new SampledPositionProperty();
const start = [16.096912, 40.4100289];
const startTime = JulianDate.now();
position.addSample(startTime, Cartesian3.fromDegrees(...start));
const diff = 0.0002;
const [x, y] = start;
for (let i = 0; i < 10; i += 1) {
const d = JulianDate.addSeconds(startTime, i + 1, new JulianDate());
const newPos = [x + diff * (i + 1), y + diff * (i + 1)];
position.addSample(d, Cartesian3.fromDegrees(...newPos));
}
app.entities.add({
ellipse: {
semiMinorAxis: 10,
semiMajorAxis: 10,
material: Color.RED,
},
path: {
resolution: 1,
width: 5,
material: Color.YELLOW,
},
position,
});
But when I launch it all I see is moving ellipse, but no path is drawn. Everywhere I searched they say you just have to have position as SampledProperty and it will work, but it doesn't seem to work for me.
In this case, as you can see, I generate data beforehand, but I also tried adding it in runtime - same result. The only working examples i was able to find where using czml - but it doesn't fit my needs - it will be real-time app.
I found the solution by digging through Cesium Sandcastle - you have to set availability property to entity with time range you want path to be shown. Would be cool if it was covered in documentation at least in some way.

Linqpad extension to plot graphs

I tried to plot some graphs in Linqpad with with "Util.RawHtml()" and "Dump()" but it is not working with this example from amcharts.com. I created a string variable including all the HTML source code but the result is not working.
string html = "";
using (System.Net.WebClient client = new System.Net.WebClient ())
{
html = client.DownloadString(#"http://pastebin.com/raw/pmMMwXhm");
}
Util.RawHtml(html).Dump();
Later versions of LinqPad 5 now support charting out of the box with Util.Chart. You can see the samples in the Samples Tab (next to My Queries) under
LINQPad Tutorial&Reference
Scratchpad Features
Charting with Chart
The following script is the Chart() - dual scale sample:
// Each y-series can have a different series type, and can be assigned to the secondary y-axis scale on the right.
var customers = new[]
{
new { Name = "John", TotalOrders = 1000, PendingOrders = 50, CanceledOrders = 20 },
new { Name = "Mary", TotalOrders = 1300, PendingOrders = 70, CanceledOrders = 25 },
new { Name = "Sara", TotalOrders = 1400, PendingOrders = 60, CanceledOrders = 17 },
};
customers.Chart (c => c.Name)
.AddYSeries (c => c.TotalOrders, Util.SeriesType.Spline, "Total")
.AddYSeries (c => c.PendingOrders, Util.SeriesType.Column, "Pending", useSecondaryYAxis:true)
.AddYSeries (c => c.CanceledOrders, Util.SeriesType.Column, "Cancelled", useSecondaryYAxis:true)
.Dump();
As I understand it, this will not work because the html contains scripts that will not be executed.
As an alternative, you can still use the old (and deprecated) google charts api, eg
var link = #"http://chart.apis.google.com/chart?chxt=y&chbh=a&chs=300x225&cht=bvg&chco=A2C180,3D7930&chd=t:10,20,30,40,50,60|30,35,40,45,55,60&chtt=Sample";
Util.Image (link).Dump();
or see
http://blog.divebomb.org/2012/11/dumping-charts-in-linqpad/
Not sure if it's the answer you're after but there may be value in looking at the DisplayWebPage method on the Util class in Linqpad. This correctly rendered your chart in the result window, (although there was a script error). Obviously, this may not solve your underlying issue.
I used version 5.10.00 to test this.

Get an array of file names without extensions from a directory in Gulp?

I want to get each of the file names in 2 directories (helpers/ and dialogs/) into an array without the file extension using Gulp and/or NPM. Note that the array will be pre-populated with values - I need to append the file names to this array.
In other words, my directory structure is like this:
helpers/
a.js
b.js
c.js
dialogs/
x.js
y.js
z.js
I have this:
var modules = ['main-module'];
And I need to populate my array like this based on the directories:
var modules = ['main-module', 'a', 'b', 'c', 'x', 'y', 'z'];
How do I do that?
I have tried using the fs module fs.readdirSync along with gulp-rename, but it would be nice to get this task done in a single streamed operation, if possible.
It would also be useful to get each directory into its own array for other operations - in other words, output a combined array and 2 individual arrays (total of 3 arrays) based on the directories.
var modules = ['main-module', 'a', 'b', 'c', 'x', 'y', 'z'];
var helpers = ['a', 'b', 'c'];
var dialogs = ['x', 'y', 'z'];
You can do it easily with glob, here is a code doing what you want.
var glob = require('glob');
var path = require('path');
var modules = ['main-module'];
var helpers = [];
var dialogs = [];
glob.sync("#(helpers|dialogs)/*.js")
.forEach(function(file) {
var module = path.basename(file, path.extname(file))
modules.push(module);
switch(path.dirname(file)) {
case 'helpers':
helpers.push(module);
break;
case 'dialogs':
dialogs.push(module);
break;
}
});

Background color change on dynamic page

I am building a webstore, where the quantity of displayed products is dinamically changing, by pressing "Show more" button. Background color should be changing multiple times while scrolling down and I found this article, which solves this problem, but it has fixed page height. Is it possible to change that?
You use a parameter to control the adaption rate and set this according to your needs if you don't know the page size on forehand (because a dynamic load for instance).
cStart = [250, 195, 56] // Gold
, cEnd = [179, 217, 112] // Lime
, cDiff = [cEnd[0] - cStart[0], cEnd[1] - cStart[1], cEnd[1] - cStart[0]];
$(document).ready(function(){
$(document).scroll(function() {
var speed = 0.0005;
var p = $(this).scrollTop()* speed;
p = Math.min(1, Math.max(0, p)); // Clamp to [0, 1]
var cBg = [Math.round(cStart[0] + cDiff[0] * p), Math.round(cStart[1] + cDiff[1] * p), Math.round(cStart[2] + cDiff[2] * p)];
$("body").css('background-color', 'rgb(' + cBg.join(',') +')');
});
});