他のセッションがあれば、ログインする前に全部からログアウトします
このコミットが含まれているのは:
コミット
e8f79077c9
|
@ -60,6 +60,11 @@ trait AuthenticationTrait {
|
|||
return ['status_code' => 400, 'error_message' => ['ログインに失敗しました。10回連続で失敗すると、一定期間ログインできなくなります。']];
|
||||
}
|
||||
|
||||
// 既にセッションがあれば、ログアウトします。
|
||||
if (Session::has('children')) Session::forget('children');
|
||||
if (Session::has('fathers')) Session::forget('fathers');
|
||||
if (Session::has('admins')) Session::forget('admins');
|
||||
|
||||
// セッションを想像する
|
||||
$guard = $this->getGuard();
|
||||
if (!$r->session()->has($guard)) {
|
||||
|
|
|
@ -137,7 +137,7 @@ class ChildrenController extends Controller {
|
|||
$password = Hash::make($r->password);
|
||||
|
||||
if (!is_null($r->image)) {
|
||||
$filename = $this->uuidv4() . '.jpg';
|
||||
$filename = $this->uuidv4().'.jpg';
|
||||
}
|
||||
|
||||
$insert = [
|
||||
|
@ -410,7 +410,7 @@ class ChildrenController extends Controller {
|
|||
return ['status_code' => 422, 'error_messages' => $validate->errors()];
|
||||
}
|
||||
|
||||
$filename = $this->uuidv4() . '.jpg';
|
||||
$filename = $this->uuidv4().'.jpg';
|
||||
$oldimg = null;
|
||||
|
||||
try {
|
||||
|
|
|
@ -177,7 +177,7 @@ class FathersController extends Controller {
|
|||
$password = Hash::make($r->password);
|
||||
|
||||
if (!is_null($r->image)) {
|
||||
$filename = $this->uuidv4() . '.jpg';
|
||||
$filename = $this->uuidv4().'.jpg';
|
||||
$image = base64_decode(substr($r->image, strpos($r->image, ',') + 1));
|
||||
Storage::disk('private')->put($filename, $image);
|
||||
|
||||
|
@ -300,7 +300,7 @@ class FathersController extends Controller {
|
|||
}
|
||||
|
||||
// 同じく子画面から他の親の詳細ページをアクセスすれば、404となります。
|
||||
if (request()->route()->action['as'] == 'mdc') {
|
||||
if (request()->route()->action['as'] == 'pdc') {
|
||||
abort_if(null === session()->get('children') || null === ($rel = FatherRelation::where('father_id', (int)$father_id)->where('child_id', (int)session()->get('children')['id'])->first()), 404, $err);
|
||||
}
|
||||
|
||||
|
@ -345,7 +345,7 @@ class FathersController extends Controller {
|
|||
return ['status_code' => 422, 'error_messages' => $validate->errors()];
|
||||
}
|
||||
|
||||
$filename = $this->uuidv4() . '.jpg';
|
||||
$filename = $this->uuidv4().'.jpg';
|
||||
$oldimg = null;
|
||||
|
||||
try {
|
||||
|
|
|
@ -6,6 +6,7 @@ use App\Http\Controllers\Controller, Session;
|
|||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Symfony\Component\HttpFoundation\StreamedResponse;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
use App\Models\Meeting;
|
||||
use App\Models\MeetingImage;
|
||||
|
@ -29,20 +30,27 @@ class FilesController extends Controller {
|
|||
}
|
||||
}
|
||||
else {
|
||||
// dd(1);
|
||||
if (null !== ($meetimg = MeetingImage::where('image', '/files/'.$path)->first())) {
|
||||
// dd(2);
|
||||
if (session()->has('children')) {
|
||||
// dd(3);
|
||||
abort_if(null === ($rel = FatherRelation::where('child_id', (int)session()->get('children')['id'])->first()), 404, $err);
|
||||
abort_if(null === (Meeting::where('id', $meetimg->meeting_id)->where('father_id', $rel->father_id)->first()), 404, $err);
|
||||
}
|
||||
if (session()->has('fathers')) {
|
||||
// dd(4);
|
||||
abort_if(null === (Meeting::where('id', $meetimg->meeting_id)->where('father_id', (int)session()->get('fathers')['id'])->first()), 404, $err);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// dd(5);
|
||||
if (session()->has('children')) {
|
||||
// dd(6);
|
||||
abort_if(null === (Child::where('id', (int)session()->get('children')['id'])->where('image', '/files/'.$path)->first()), 404, $err);
|
||||
}
|
||||
else if (session()->has('fathers')) {
|
||||
if (session()->has('fathers')) {
|
||||
// dd(7);
|
||||
abort_if(null === (Father::where('id', (int)session()->get('fathers')['id'])->where('image', '/files/'.$path)->first()), 404, $err);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ class MeetingImagesController extends Controller {
|
|||
|
||||
try {
|
||||
foreach (json_decode($r->image) as $img) {
|
||||
$filename = $this->uuidv4() . '.jpg';
|
||||
$filename = $this->uuidv4().'.jpg';
|
||||
$fname[] = $filename;
|
||||
$image = base64_decode(substr($img, strpos($img, ',') + 1));
|
||||
Storage::disk('private')->put($filename, $image);
|
||||
|
|
|
@ -98,7 +98,7 @@ class MeetingsController extends Controller {
|
|||
|
||||
try {
|
||||
if (isset($r->pdf)) {
|
||||
$filename = $this->uuidv4() . '.pdf';
|
||||
$filename = $this->uuidv4().'.pdf';
|
||||
$insert['pdf'] = '/files/'.$filename;
|
||||
|
||||
if (substr($r->pdf, -4) != '.pdf') {
|
||||
|
@ -763,7 +763,7 @@ class MeetingsController extends Controller {
|
|||
try {
|
||||
// リクエストでPDFがある場合
|
||||
if (isset($r->pdf) && !is_null($r->pdf)) {
|
||||
$filename = $this->uuidv4() . '.pdf';
|
||||
$filename = $this->uuidv4().'.pdf';
|
||||
|
||||
// DBにミーティングがある場合
|
||||
if ($chk = Meeting::select('pdf')->where('id', (int)$meeting_id)->first()) {
|
||||
|
|
新しいイシューから参照