Email date in header (CodeIgniter) is 7 hours off - codeigniter

When we receive mail from our website, through CodeIgniter first then Google Apps (mailer) - the date in the header is 7 hours behind the real time.
We've checked the server time, and it is correctly set.
Has anyone experienced this problem?
Thanks!

It may have something to do with this setting in system/application/config/config.php:
/*
|--------------------------------------------------------------------------
| Master Time Reference
|--------------------------------------------------------------------------
|
| Options are "local" or "gmt". This pref tells the system whether to use
| your server's local time as the master "now" reference, or convert it to
| GMT. See the "date helper" page of the user guide for information
| regarding date handling.
|
*/
$config['time_reference'] = 'local';

Related

Laravel have same folder for multiple langs?

In laravel can I have default lang folder? In other words now I have
lang
en
lang
ru
I don't need to have each folder for each language because I read data from the database. I need something like this and it must work for all locales. Is it possible?
lang
def
In config/app.php:
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'en',
The default fallback folder by default is lang/en. You can change it to def
Yes, you can have multiple languages in the same lang directory without additional configuration. Check the docs if you need additional guidance.

How can I modify login error message in Laravel?

I am using Laravel 6, my project is working fine, but when I enter wrong login details, I am getting an error.
These credentials do not match our records.
How I can modify this error message and provide my custom message if there's an error in the user name or password. I tried to find this message in LoginController and Laravel vendor folder, but I couldn't find it. Can anyone please tell me the exact location of that file where this error message is located?
You can change it in /resources/lang/en/auth.php.
return [
/*
|--------------------------------------------------------------------------
| Authentication Language Lines
|--------------------------------------------------------------------------
|
| The following language lines are used during authentication for various
| messages that we need to display to the user. You are free to modify
| these language lines according to your application's requirements.
|
*/
'failed' => 'These credentials do not match our records.',
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
];
You can find that on this location
resources/lang/en/auth.php
if you want someting custom and more specific check AuthenticatesUsers.php and override function sendFailedLoginResponse in LoginController.php

Laravel 5.1 Configuration Session Lifetime Apply Changes

simple question here. In my laravel config/session.php I have changed the lifetime value from the default 2 hours to this:
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
*/
'lifetime' => 1440,
'expire_on_close' => true,
/*
However, even though this is what I have on my server, it still sticks to the default 2 hour session. I can verify this by seeing the cookie laravel_session which always maxes out in 2 hours.
What am I missing? Is there a separate configuration file or value I need to change to apply my new lifetime?
Edit: Well apparently you can't expect both the lifetime and the expire_on_close option to both be operating at the same time because they utilize two different types of cookies, but I still don't understand why if I have the expire_on_close set to true why my cookie is expiring in 2 hours rather than when the browsing session ends?
php artisan config:cache applies changes to the configuration files!

Why sometimes laravel doesn't react?

Sometimes when i bring changes in CSS or in HTML contents or maybe controllers, i refresh many times but the change not applies in the app and it still looks like the past. Does anyone faced this problem? or how i'm going to solve this issue?
If you're not using PSR-4 autoloading. You'll need to reflect new controllers with $ composer dump-autoload -o (note the -o optimises the class-mapping).
Other than that, are you behind any caching drivers?
For good measure, change the following in your development cache config(\app\config\development\cache.php) (Don't have a development folder? Read this) as well:
<?php
return array(
/*
|--------------------------------------------------------------------------
| Default Cache Driver
|--------------------------------------------------------------------------
|
| This option controls the default cache "driver" that will be used when
| using the Caching library. Of course, you may use other drivers any
| time you wish. This is the default when another is not specified.
|
| Supported: "file", "database", "apc", "memcached", "redis", "array"
|
*/
'driver' => 'file',
Laravel will store all your cache files in the following folder: app\storage\cache and view caches in: app\storage\view. Clear both when necessary.

csrf TokenMismatchException in Laravel

I created a webshop using Laravel and everything has been going smoothly until recently I started getting TokenMismatchExceptions.
The users are able to log in without any problems. The issue occurs whenever a user tries to add an item to the shopping-cart. I didn't really change anything on the page, and it seems that this started to occur by it self. The only thing I did to the server was clearing the cache. Could this cause the issue to occur?
All my controllers start with:
public function __construct() {
parent::__construct();
$this->beforeFilter('csrf', array('on'=>'post'));
}
My sessions config is set up like this:
/*
|--------------------------------------------------------------------------
| Default Session Driver
|--------------------------------------------------------------------------
|
| This option controls the default session "driver" that will be used on
| requests. By default, we will use the lightweight native driver but
| you may specify any of the other wonderful drivers provided here.
|
| Supported: "file", "cookie", "database", "apc",
| "memcached", "redis", "array"
|
*/
'driver' => 'file',
/*
|--------------------------------------------------------------------------
| Session Lifetime
|--------------------------------------------------------------------------
|
| Here you may specify the number of minutes that you wish the session
| to be allowed to remain idle before it expires. If you want them
| to immediately expire on the browser closing, set that option.
|
*/
'lifetime' => 15,
'expire_on_close' => false,
Am I using the csrf filter wrong? I can't seem to find a solution to this issue.
-EDIT-
I tried taking off my csrf filters from the controllers, and now the user gets automatically logged off when adding an item to the shopping-cart (I guess this is the problem).

Resources