How to fix NoCaptcha error with site key? - php

In my my laravel 5.7.3 application I use https://github.com/anhskohbo/no-captcha
For this I installed this package and added refs to config/app.php file.
After that I went By link and with my google account I have next account :
https://imgur.com/a/leBrPOt
But inserting next rows in my blade template:
<div class="form-row mb-3">
{!! NoCaptcha::renderJs() !!}
</div>
and in my .env file I added lines :
NOCAPTCHA_SECRET=6LcRPHEUAAAAAKXPSZt0Hjjibxa1p_iq6XbH6sFk
NOCAPTCHA_SITEKEY=6LcRPHEUAAAAAPx8iLqBT1bThH1XfIhdcDYs-ssU
as I see I entered valid NoCapture parameters and published config file.
after I cleared the cach with commands :
php artisan cache:clear
php artisan config:cache
But on my form I see image recapture block with error :
ERROR for site owner: Invalid site key
I did not insert any code in my control or in my blade template, as it was not mentioned in docs.
Why error ? Did I miss some options?

in addition to #Mohammad's answer, The idea is that the error is coming from google not from the package.
The issue is most likely with the specification of domains.
Add all the domains accordingly including the development domains, as seen in the image. Link to recaptcha

I think your chosen domains are wrong.
If it is localhost, be sure to enter the API KEY localhost or domain.com creation time.
or multi domain :
localhost
domain.com
...

Related

Shopify: There’s no page at this address Check the URL and try again, or use the search bar to find what you need

I’m new to Shopify App development. I’ve developed an app using a php template provided by shopify. It’s using Laravel & React. It’s https://github.com/Shopify/shopify-app-template-php/tree/cli_three
When I execute npm run dev, the app is running in the development store.
Then, I deployed my app on the AWS server using one domain (e.g: sub.mydomain.com).
Before deployment:
I have build the frontend using: SHOPIFY_API_KEY=MY_API_KEY npm run build
I’ve run composer build too.
After that, I tried to install the app. While doing so, It’s authenticating and saving the session in the database too.
But, on redirecting after authentication, it’s not working,
First, It’s giving this error on console:
Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('https://mystore.myshopify.com') does not match the recipient window's origin ('https://sub.mydomain.net').
And then after redirect, it’s displaying:
Along with console error:
GET https://mystore.myshopify.com/admin/apps/40aac89c4c56232219d0f1f75a1f2ae7/?hmac=68236dae6688aafd05925cf409dfff0965236542401999f8ff47decd8b942d&host=cW9kZWFuYWx5dGljcy5JKihgZnkuY29tL2FkbWlu&shop=mystore.myshopify.com&timestamp=1657698129 404
About that console error you need to add this header on top of the page in views top_level.blade.php
<?php
$domain= $shop ?? Auth::user()->name ; ; // loged-in shopify store url example.myshopify.com
header("Content-Security-Policy: frame-ancestors https://".$domain." "."https://admin.shopify.com");
?>
This will resolve the does not match the recipient window's origin error.
After that try to open the app again or you can remove the entry from db and install the app again hope that will help.

LdapRecord Laravel - Active Directory - does not see any users

I am using the ready package as a base, I have done all steps in the readme.md file and was able to login as "einstein" user. So all seems to be configured correctly.
Later I have changed the credentials for the ldap server, which is using Active Directory.
While runing command php artisan ldap:test i receive message that i was able to connect correctly. Laravel logs says the same, but I cannot log in to laravel app. While running the command php artisan ldap:import ldap get message that no users where find
In the log file i see something like this:
[2021-04-28 23:04:08] local.INFO: LDAP (ldap://domain.pl:389) - Operation: Search - Base DN: cn=username#domain.pl,ou=Users,dc=domain,dc=pl - Filter: (&(objectclass=top)(objectclass=person)(objectclass=organizationalperson)(objectclass=inetorgperson)(uid=username)) - Selected: (entryuuid,*) - Time Elapsed: 737.37
Have anyone had the same issue with the ldaprecord that he was able to connect to domain but wasn't able to authenticate to an app ? And was able to solve that ?
UPDATE: i've found that auth.php is using wrong User model, it was using OpenLdap not Active directory, changed that but result is still the same
Problem solved, to make it work with AD you need to:
in the auth.php file switch model to ActiveDirectory
in login controller change in the credentials function have to change 'uid' key to 'sameaccountname'

google recaptcha v2 in livewire component comes with issues

I'm trying to implement google recaptcha v2 with livewire but I get some issues :
The issue that I get is when I try to call RECAPTCHA_SITE_KEY from the .env file it display me this error message in Dev Console :
"Uncaught Error: Missing required parameters: sitekey"
it confusing because the site key is correct and is already exist inside .env file.
Wile I remove the {{ env('RECAPTCHA_SITE_KEY') }} from data-sitekey and add the site key it work
Not Working example :
data-sitekey="{{ env('RECAPTCHA_SITE_KEY') }}"
"Uncaught Error: Missing required parameters: sitekey"
Working example :
data-sitekey="XXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
Where this problem coming from ?
First, double check that is is spelled exactly the same in your .env. Second, run php artisan cache:clear in case your config is cached. Third, attempt env('RECAPTCHA_SITE_KEY'); from php artisan tinker and see what results you get.

Laravel Verify Email Address Issue

I have a problem with Laravel 5.7.22, I tried to activate the verification with the email and I get the message that:
A fresh verification link has been sent to your email address.
how it's properly working at least the part that send the emails with the verification link but when I click the generated link I get the following page:
I have tried to erase the project and reinstall it, and I also tried to generate the signature key with this command:
php artisan key:generate
that I have found in this other question, but that didn't work, I don't know what could be causing this issue.
I also tried to debug the the function hasValidSignature in the file UrlGenerator from Laravel, just because I read that it could help, but it doesn't make sense, I haven't event altered the middleware or something I'm just with the laravel routes that it generates by default.
The generated link looks something like this.
https://www.example.com/email/verify/1?expires=1548527438&signature=daebab97afbb2da6a0f37615bc3db7e59db9c59e704d185addcf88adf46e8f6d
I also have configured my .env file properly and the files under the config folder just for security.

Add syslog handler in Laravel for paperTrail .

How could i link Laravel log files to PaperTrial ?
According to this article :
http://mattstauffer.co/blog/laravel-forge-logging-with-papertrail#step-4-add-a-syslog-handler
I followed steps and reached to step 4 putting Syslog Monolog handler in the /app/route.php file ,went to PaperTrial dashboard but i didn't see any output.
Any help ? thanks.
For Laravel 5.1 after setting up the forge, you should add to bootstrap/app.php file the following code just before the return of the $app variable
$app->configureMonologUsing(function($monolog){
$monolog->pushHandler(new Monolog\Handler\SyslogHandler('papertrail'));
});
return $app;
The parameter (in this case 'papertrail') can be whatever you want to, this name will show on the papertail's event screen.
I have it working using the standard logging facility instead of Monolog. This way there is nothing extra to install. Just add this to rsyslogd's conf:
### Laravel Log
$InputFileName /path/to/vhost/dir/app/storage/logs/laravel.log
$InputFileTag laravel-errors-domain.com:
$InputFileStateFile state-laravel-errors-domain.com
$InputFileSeverity error
$InputRunFileMonitor
And make sure that this log gets included in the send action, if you are not sending everything.
Then issue
service rsyslog restart
From my experience using Laravel 5.2.* with Forge, Step 4 from that article is not necessary anymore. All you have to do after Step 3 is set your Environment .env settings in Forge to APP_LOG=syslog for each site you want to use with papertrail.
However, this means that Laravel will not log to laravel.log anymore in this environment. But, in other environments (e.g. dev environment) you could of course continue logging to laravel.log by simply not making any changes to the .env file there.

Categories