mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-25 06:51:08 +00:00
Show message.
This commit is contained in:
@@ -6,6 +6,7 @@ use Illuminate\Foundation\Bus\DispatchesJobs;
|
|||||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||||
use Illuminate\Routing\Controller as BaseController;
|
use Illuminate\Routing\Controller as BaseController;
|
||||||
use Preferences;
|
use Preferences;
|
||||||
|
use Session;
|
||||||
use View;
|
use View;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -44,6 +45,13 @@ abstract class Controller extends BaseController
|
|||||||
View::share('language', $lang);
|
View::share('language', $lang);
|
||||||
|
|
||||||
// the user is bouncing email.
|
// the user is bouncing email.
|
||||||
|
$bounce = Preferences::get('bounce', 'notBounced')->data;
|
||||||
|
if ($bounce != 'notBounced') {
|
||||||
|
$email = Auth::user()->email;
|
||||||
|
$message = trans('firefly.bounce_error', ['email' => $email, 'message' => $bounce]);
|
||||||
|
Session::flash('error', $message);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace FireflyIII\Http\Controllers;
|
namespace FireflyIII\Http\Controllers;
|
||||||
|
|
||||||
|
use FireflyIII\Models\Preference;
|
||||||
use FireflyIII\User;
|
use FireflyIII\User;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28,23 +29,23 @@ class CronController extends Controller
|
|||||||
$fullURL = $URL . '?' . http_build_query($parameters);
|
$fullURL = $URL . '?' . http_build_query($parameters);
|
||||||
$data = json_decode(file_get_contents($fullURL));
|
$data = json_decode(file_get_contents($fullURL));
|
||||||
$users = [];
|
$users = [];
|
||||||
|
echo "<pre>\n";
|
||||||
// loop the result, if any.
|
// loop the result, if any.
|
||||||
if (is_array($data)) {
|
if (is_array($data)) {
|
||||||
foreach ($data as $entry) {
|
foreach ($data as $entry) {
|
||||||
$address = $entry->email;
|
$address = $entry->email;
|
||||||
$users[] = User::where('email', $address);
|
$user = User::where('email', $address)->first();
|
||||||
|
if (!is_null($user)) {
|
||||||
|
$users[] = $user;
|
||||||
|
echo "Blocked " . $user->email . " because a message bounced.\n";
|
||||||
|
|
||||||
|
// create preference:
|
||||||
|
$preference = Preference::firstOrCreate(['user_id' => $user->id, 'name' => 'bounce']);
|
||||||
|
$preference->data = $entry->reason;
|
||||||
|
$preference->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var User $user */
|
|
||||||
foreach($users as $user) {
|
|
||||||
if($user) {
|
|
||||||
// block because bounce.
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
@@ -18,6 +18,7 @@ return [
|
|||||||
'showEverything' => 'Show everything',
|
'showEverything' => 'Show everything',
|
||||||
'never' => 'Never',
|
'never' => 'Never',
|
||||||
'search_results_for' => 'Search results for ":query"',
|
'search_results_for' => 'Search results for ":query"',
|
||||||
|
'bounce_error' => 'The message sent to :email bounced.',
|
||||||
|
|
||||||
// attachments
|
// attachments
|
||||||
'nr_of_attachments' => 'One attachment|:count attachments',
|
'nr_of_attachments' => 'One attachment|:count attachments',
|
||||||
|
@@ -18,9 +18,12 @@ return [
|
|||||||
'showEverything' => 'Laat alles zien',
|
'showEverything' => 'Laat alles zien',
|
||||||
'never' => 'Nooit',
|
'never' => 'Nooit',
|
||||||
'search_results_for' => 'Zoekresultaten voor ":query"',
|
'search_results_for' => 'Zoekresultaten voor ":query"',
|
||||||
|
'bounce_error' => 'The message sent to :email bounced.',
|
||||||
|
|
||||||
'nr_of_attachments' => 'Eén bijlage|:count bijlagen',
|
'nr_of_attachments' => 'Eén bijlage|:count bijlagen',
|
||||||
'attachments' => 'Bijlagen',
|
'attachments' => 'Bijlagen',
|
||||||
|
|
||||||
|
|
||||||
// tour:
|
// tour:
|
||||||
'prev' => 'Vorige',
|
'prev' => 'Vorige',
|
||||||
'next' => 'Volgende',
|
'next' => 'Volgende',
|
||||||
|
Reference in New Issue
Block a user