Laravel - Wrong password generate 'Error' in logs - laravel

When a user puts in a bad password, I see it as the level of ERROR in the logs which does not seem like it deserves to be that critical. I alarm off errors so I can understand health of the system. Is there anyway to turn this down to a warning or info...
`production.ERROR: array (
'error' => 'The given data was invalid.',
'errorLine' => 71,
'errorFile' =>
/var/www/html/dashboard/vendor/laravel/framework/src/Illuminate/Validation/ValidationException.php',
'error_catch_scope' => 'report',
'error_catch_file' => '/var/www/html/dashboard/app/Exceptions/Handler.php',
)
I am using laravel 5.7

Related

Laravel localization file format error: array() versus [] format

I am struggling a bit with localization in Laravel 5.3 (with php 7). The default localizaiton file format in Laravel 5.3 is using brackets, as in this example:
return [
'footer.contact.email' => 'Email:',
]
That's what I have been using in my app and it's working fine. But now I am trying to work with some packages to help with translations, for example:
https://github.com/potsky/laravel-localization-helpers
https://github.com/barryvdh/laravel-translation-manager
But both of those generate localization files in the "old" laravel 4.x array format. For example
return array(
'footer' => array(
'contact' => array(
'email' => 'Email:',
),
),
);
As I understand it I should have no issue with this localization file format in my laravel 5.3 app, however it's always throwing an exception:
[2016-12-02 13:26:01] local.ERROR: ErrorException: htmlspecialchars() expects parameter 1 to be string, array given in C:\100_source_code\consulting_platform_laravel\maingig\vendor\laravel\framework\src\Illuminate\Support\helpers.php:519
Stack trace:
#0 C:\100_source_code\consulting_platform_laravel\maingig\vendor\sentry\sentry\lib\Raven\Breadcrumbs\ErrorHandler.php(36): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(2, 'htmlspecialchar...', 'C:\\100_source_c...', 519, Array)
I really cant understand why this format is not working with my app. I bet it is something trivial that I am missing, but any help would be very welcome!
Thanks,
Christian
After a few extra hours of stepping through the code I found the source of the problem.
For example, I got these in my original lang file:
'footer.subscribe' => 'SUBSCRIBE TO OUR NEWSLETTER',
'footer.subscribe.intro' => 'Be the first to know about our latest news...',
'footer.subscribe.privacy' => 'Privacy Policy',
'footer.subscribe.tos' => 'Terms of Service',
'footer.subscribe.tac' => 'Terms and Conditions',
As I tried to use both of the packages mentioned in my original question they produced the following output:
'footer' =>
array (
'subscribe' =>
array (
'intro' => 'TODO: intro',
'privacy' => 'TODO: privacy',
'tos' => 'TODO: tos',
'tac' => 'TODO: tac',
),
),
As you can see the generated file dropped the value for the text footer.subscribe and only kept the child element, intro, privacy, tos and tas in this case. Therefore a request for trans('footer.subscribe') returns an array and not the text.
Now that I know this I will change the format of my original translation file!
c.

Can't use RubyPress gem gives getaddrinfo: No such host is known. (SocketError)

I am trying to use a gem called RubyPress which allows to use Wordpress' xml-rpc api from ruby. But it always gives me this error:
getaddrinfo: No such host is known. (SocketError)
Here's my code:
require 'rubypress'
wp = Rubypress::Client.new(:host => "localhost/wordpress",
:username => "admin",
:password => "admin")
p wp.getOptions
I am able to connect fine using another gem called wp_rpc but rubypress doesn't seem to work. Rubypress seems to be maintained so i want to use it, it also seems to have more features.
Also, even when i try connecting to a real site, it gives a 403 error which is very strange.
I am running the server using XAMPP on Windows 7. How can I get it to work?
UPDATE:
Here's the code i used for posting, now it doesn't seem to post. Not sure where i went wrong.
wp.newPost( :blog_id => 0, # 0 unless using WP Multi-Site, then use the blog id
:content => {
:post_status => "publish",
:post_date => Time.now,
:post_content => "This is the body",
:post_title => "RubyPress is the best!",
:post_name => "/rubypress-is-the-best",
:post_author => 1, # 1 if there is only the admin user, otherwise the user's id
:terms_names => {
:category => ['Category One','Category Two','Category Three'],
:post_tag => ['Tag One','Tag Two', 'Tag Three']
}
}
)
Note: This is from the rubypress github page. Those categories and tags are not present on the blog, is that the reason?
host must be a host name (e.g. "localhost" in this particular case, or, say, "google.com"):
require 'rubypress'
wp = Rubypress::Client.new(host: "localhost",
username: "admin",
password: "admin",
path: "/wordpress/xmlrpc.php")
Probably, you might need to tune the path parameter up to point exactly to where WP’s RPC endpoint is to be found.

puppet add user to local windows group

For a couple of weeks I'm struggling with puppet. I do have it pretty much working but i keep getting issues to add a user to the built-in group "Administrators".
I do can add an user to that group, but removing is not possible. This is an local user, without a domain-controler
Here is my manifest:
#Adding user to administrators-group;
class developers {
user {'user_erik':
name => 'Erik.dev',
ensure => present,
comment => 'Developer',
groups => ['Administrators],
membership => inclusive,
password => 'blaat123',
}
}
#removing (not working);
class developers {
user {'user_erik':
name => 'Erik.dev',
ensure => present,
comment => 'Developer',
groups => [],
membership => inclusive,
password => 'blaat123',
}
}
# another way to set this up;
class developers {
user {'user_erik':
name => 'Eric.dev',
ensure => present,
comment => 'Developer',
groups => [],
membership => inclusive,
password => 'blaat123',
}
group{'admin':
name => 'Administrators',
ensure => present,
members => ['Erik.dev'],
}
}
getting error:
Error:
OLE error code:8007055B in Active Directory
" Cannot perform this operation on built-in accounts "
In UNIX I have no problems, but windows is almost killing me and I cannot find my answer on the internet.
Hope someone has it working.
thanks
Dave
I'm going to assume this is a copy pasta error:
user {'user_erik':
name => 'Erik.dev',
ensure => present,
comment => 'Developer',
groups => ['Administrators],
membership => inclusive,
password => 'blaat123',
}
note groups is missing an apostrophe. groups => ['Administrators] should be groups => ['Administrators']
Let's take a look at the remove:
user {'user_erik':
name => 'Erik.dev',
ensure => present,
comment => 'Developer',
groups => [],
membership => inclusive,
password => 'blaat123',
}
I think you are running into a derivative of PUP-3653, where you are trying to remove a user from all groups. I would instead put the user in at least one group (perhaps 'Users'?).
Group Membership
With groups, you must specify the complete list of members. Group auth_membership => minimum is ignored in less than Puppet 4.0.0. See PUP-2628 and PUP-3719 for details.
The error
Error: OLE error code:8007055B in Active Directory " Cannot perform
this operation on built-in accounts "
is most likely related to:
group{'admin':
name => 'Administrators',
ensure => present,
members => ['Erik.dev'],
}
Right now you would need to specify the complete list and you can't remove built-in accounts from the Administrators group. Because this isn't the complete list, Puppet is attempting to remove LocalSystem from the list and running into issues, generating the error you see above.
In Puppet 4.x you can specify it like the above or you can specify it like this:
group{'admin':
name => 'Administrators',
ensure => present,
members => ['Erik.dev'],
auth_membership => false,
}

Sagepay Simulator Vendor Error

I'm trying to perform transaction using Sagepay Server API. I've properly setup by simulator vendor account and also added the IP address. Still im getting the following error
Sage Pay returned an MALFORMED status. The POST was Malformed because "Simulator cannot find your vendor name. Ensure you have have supplied a Vendor field with your Vendor name assigned to it."
Here is my POST request data
[VPSProtocol] => 2.23
[TxType] => PAYMENT
[Currency] => GBP
[Vendor] => curiouslabx
[NotificationUrl] => http://localhost:8080/numberplate/sagepay_notification
[Description] => Purchase of number plate AU59STG
[AllowGiftAid] => 0
[ApplyAVSCV2] => 0
[Apply3DSecure] => 0
[Profile] => NORMAL
[AccountType] => E
[Amount] => 700.00
[success_url] => http://localhost:8080/numberplate/payment/payment_status/success/
[failure_url] => http://localhost:8080/numberplate/payment/payment_status/failure/
[BillingFirstnames] => test
[BillingSurname] => test
[BillingAddress1] => test
[BillingAddress2] => test
[BillingCity] => testtest
[BillingPostCode] => test
[BillingCountry] => test
[BillingState] => test
[BillingPhone] => test
[DeliveryFirstnames] => test
[DeliverySurname] => test
[DeliveryAddress1] => test
[DeliveryAddress2] => test
[DeliveryCity] => testtest
[DeliveryPostCode] => test
[DeliveryCountry] => test
[DeliveryState] => test
[DeliveryPhone] => test
[VendorTxCode] => 14-04-30-20-10-53-572086512
I'm using sagepay server library for codeigniter https://github.com/ollierattue/codeigniter-sagepay-server/
If you are using the Simulator, things are in a bad way anyway. It does not support protocol 3.00 - your will need to integrate at this level, or your integration will cease to function on 31/7/15

meaning of failure_reset_period option in win32-service gem for Ruby

Creating new service with win32-service, what's the meaning of the failure_reset_period ?
I'll appreciate some words on other options too (failure_reboot_message, failure_command, failure_actions, failure_delay) and examples.
Thank you in advance.
an example of use:
Service.new(
:service_name => SERVICE_NAME,
:display_name => SERVICE_DISPLAYNAME,
:start_type => Service::AUTO_START,
:error_control => Service::ERROR_NORMAL,
:service_type => Service::WIN32_OWN_PROCESS,
:description => 'This service does blah blah..',
:binary_path_name => path,
:failure_reset_period => 86400, # period (in seconds) with no failures after which the failure count should be reset to 0
:failure_actions => [ Service::ACTION_RESTART ], # action to take
:failure_delay => 60000 # delay before action in milliseconds
)
failure_reset_period resets to 0 the failure count on the service after specified time, what is useful since you can configure different actions for the first, second and other failures of the service.
meaning of those options is described here, for failure_reset_period:
the number of days that must pass before the service fail count is
reset
What if I need to set second and third failure options having different failure_delay?

Resources