Tourenplan+Mitgliedsantrag Upload & E-Mail Setup, Passwort-Reset Link sending

This commit is contained in:
Torsten Schneider 2021-02-21 11:49:05 +01:00
parent e951d11a0b
commit ea9fdc6a82
25 changed files with 123 additions and 46 deletions

View file

@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Page;
use Illuminate\Support\Facades\Log;
class AdminController extends Controller
{
@ -14,21 +15,24 @@ class AdminController extends Controller
public function store_tourplan(Request $request)
{
Log::debug("Store Tourplan");
$request->validate(
[
'tourplan'=>'required|mimes:pdf|max:2048'
]
);
$request->file('tourplan')->storeAs('pdf', 'tourenplan.pdf','public2');
return view ('/home');
$path=$request->file('tourplan')->storeAs('pdf', 'Tourenplan.pdf','img_storage');
Log::debug("Stored Tourenplan to: ".$path." in private folder (storage/img_storage)");
return redirect('/');
}
public function upload_mitgliedsantrag(Request $request)
{
Log::debug("*** Show Form: UPLOAD MITGLIEDSANTRAG ***");
return view ('admin.upload_mitgliedsantrag');
}
@ -36,13 +40,15 @@ class AdminController extends Controller
{
$request->validate(
[
'mitgliedsantrag' => 'required|mimes:pdf|max:2048'
'mitgliedsantrag' => 'required|mimes:pdf'
]
);
$request->file('mitgliedsantrag')->storeAs('pdf', 'mitgliedsantrag.pdf', 'public2');
//$request->file('mitgliedsantrag')->storeAs('pdf_storage', 'mitgliedsantrag.pdf_storage', 'public2');
$path = $request->file('mitgliedsantrag')->storeAs('pdf', 'Mitgliedsantrag.pdf', 'public');
Log::debug("Stored mitgliedsantrag to: ".$path." in public folder (public/img)");
return view('/home');
return redirect('/');
}

View file

@ -17,7 +17,6 @@ class ImageController extends Controller
}
}
error_log("User is not authorized");
return response()->file(public_path()."/img/placeholder/icon_unknown.png");
}

View file

@ -63,5 +63,6 @@ class Kernel extends HttpKernel
'signed' => \Illuminate\Routing\Middleware\ValidateSignature::class,
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
'member' => \App\Http\Middleware\IsMember::class,
];
}

View file

@ -0,0 +1,23 @@
<?php
namespace App\Http\Middleware;
use Closure;
class IsMember
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
if (\Auth::user()->role == 'ADMIN' || \Auth::user()->role == 'MEMBER') {
return $next($request);
}
return redirect('/');
}
}

View file

@ -50,13 +50,15 @@ return [
'public' => [
'driver' => 'local',
'root' => storage_path('app/public'),
'root' => public_path('img'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
'public2' => [
'img_storage' => [
'driver' => 'local',
'root' => '.'
'root' => storage_path('img_storage'),
'url' => env('APP_URL').'/img',
'visibility' => 'private',
],
's3' => [
'driver' => 's3',

View file

@ -37,10 +37,16 @@ return [
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single'],
'channels' => ['single','stdout'],
'ignore_exceptions' => false,
],
'stdout' => [
'driver' => 'monolog',
'handler' => StreamHandler::class,
'with' => [
'stream' => 'php://stdout',
],
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/laravel.log'),
@ -72,6 +78,10 @@ return [
],
],
'stderr' => [
'driver' => 'monolog',
'handler' => StreamHandler::class,

View file

@ -84,8 +84,8 @@ return [
*/
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
'address' => env('MAIL_FROM_ADDRESS', 'info@motorrad-ig.de'),
'name' => env('MAIL_FROM_NAME', 'Motorrad IG'),
],
/*

Binary file not shown.

View file

@ -13,7 +13,13 @@ return [
|
*/
/*
'failed' => 'These credentials do not match our records.',
'throttle' => 'Too many login attempts. Please try again in :seconds seconds.',
*/
'failed' => 'Logindaten stimmen nicht mit Datenbank überein.',
'throttle' => 'Zu viele Login-Versuche. Versuche es wieder in :seconds Sekunden.',
];

View file

@ -0,0 +1,17 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Validation Language Lines
|--------------------------------------------------------------------------
|
| The following language lines contain the default error messages used by
| the validator class. Some of these rules have multiple versions such
| as the size rules. Feel free to tweak each of these messages here.
|
*/
'You are receiving this email because we received a password reset request for your account.' =>
'Du erhältst diese E-Mail, weil die Motorrad-IG eine Rücksetzungsanfrage für Deinen Account erhalten hat.',
];

View file

@ -13,7 +13,11 @@ return [
|
*/
/*
'previous' => '&laquo; Previous',
'next' => 'Next &raquo;',
*/
'previous' => '&laquo; Zurück',
'next' => 'Weiter &raquo;',
];

View file

@ -12,11 +12,18 @@ return [
| has failed, such as for an invalid token or invalid new password.
|
*/
/*
'reset' => 'Your password has been reset!',
'sent' => 'We have emailed your password reset link!',
'throttled' => 'Please wait before retrying.',
'token' => 'This password reset token is invalid.',
'user' => "We can't find a user with that email address.",
*/
'reset' => 'Dein Passwort wurde zurückgesetzt!',
'sent' => 'Dir wurde ein Zurücksetzungslink zugesendet.',
'throttled' => 'Bitte vor dem nächsten Versuche etwas warten.',
'token' => 'Das Zurücksetzungstoken ist ungültig.',
'user' => "Es gibt niemandem mit dieser E-Mail Adresse in der Datenbank",
];

View file

@ -12,7 +12,7 @@
@csrf
<div class="form-group row">
<label for="email" class="col-md-4 col-form-label text-md-right">{{ __('E-Mail Address') }}</label>
<label for="email" class="col-md-4 col-form-label text-md-right">E-Mail Adresse</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email" autofocus>
@ -26,7 +26,7 @@
</div>
<div class="form-group row">
<label for="password" class="col-md-4 col-form-label text-md-right">{{ __('Password') }}</label>
<label for="password" class="col-md-4 col-form-label text-md-right">Passwort</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="current-password">
@ -45,7 +45,7 @@
<input class="form-check-input" type="checkbox" name="remember" id="remember" {{ old('remember') ? 'checked' : '' }}>
<label class="form-check-label" for="remember">
{{ __('Remember Me') }}
Login merken
</label>
</div>
</div>
@ -59,7 +59,7 @@
@if (Route::has('password.request'))
<a class="btn btn-link" href="{{ route('password.request') }}">
{{ __('Forgot Your Password?') }}
Passwort vergessen?
</a>
@endif
</div>

View file

@ -5,16 +5,16 @@
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Confirm Password') }}</div>
<div class="card-header">Passwort bestätigen</div>
<div class="card-body">
{{ __('Please confirm your password before continuing.') }}
Bitte bestätige dein Passwort
<form method="POST" action="{{ route('password.confirm') }}">
@csrf
<div class="form-group row">
<label for="password" class="col-md-4 col-form-label text-md-right">{{ __('Password') }}</label>
<label for="password" class="col-md-4 col-form-label text-md-right">Passwort</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="current-password">
@ -30,12 +30,12 @@
<div class="form-group row mb-0">
<div class="col-md-8 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Confirm Password') }}
Passwort bestätigen
</button>
@if (Route::has('password.request'))
<a class="btn btn-link" href="{{ route('password.request') }}">
{{ __('Forgot Your Password?') }}
Passwort vergessen ?
</a>
@endif
</div>

View file

@ -5,7 +5,7 @@
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Reset Password') }}</div>
<div class="card-header">Passwort zurücksetzen}</div>
<div class="card-body">
@if (session('status'))
@ -18,7 +18,7 @@
@csrf
<div class="form-group row">
<label for="email" class="col-md-4 col-form-label text-md-right">{{ __('E-Mail Address') }}</label>
<label for="email" class="col-md-4 col-form-label text-md-right">E-Mail Adresse</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email" autofocus>
@ -34,7 +34,7 @@
<div class="form-group row mb-0">
<div class="col-md-6 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Send Password Reset Link') }}
Zurücksetzungs-Link anfordern
</button>
</div>
</div>

View file

@ -5,7 +5,7 @@
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Reset Password') }}</div>
<div class="card-header">Passwort zurücksetzen</div>
<div class="card-body">
<form method="POST" action="{{ route('password.update') }}">
@ -14,7 +14,7 @@
<input type="hidden" name="token" value="{{ $token }}">
<div class="form-group row">
<label for="email" class="col-md-4 col-form-label text-md-right">{{ __('E-Mail Address') }}</label>
<label for="email" class="col-md-4 col-form-label text-md-right">'E-Mail Addresse</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ $email ?? old('email') }}" required autocomplete="email" autofocus>
@ -28,7 +28,7 @@
</div>
<div class="form-group row">
<label for="password" class="col-md-4 col-form-label text-md-right">{{ __('Password') }}</label>
<label for="password" class="col-md-4 col-form-label text-md-right">Passwort</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="new-password">
@ -42,7 +42,7 @@
</div>
<div class="form-group row">
<label for="password-confirm" class="col-md-4 col-form-label text-md-right">{{ __('Confirm Password') }}</label>
<label for="password-confirm" class="col-md-4 col-form-label text-md-right">Passwort bestätigen</label>
<div class="col-md-6">
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" required autocomplete="new-password">
@ -52,7 +52,7 @@
<div class="form-group row mb-0">
<div class="col-md-6 offset-md-4">
<button type="submit" class="btn btn-primary">
{{ __('Reset Password') }}
Passwort zurücksetzen
</button>
</div>
</div>

View file

@ -12,7 +12,7 @@
@csrf
<div class="form-group row">
<label for="name" class="col-md-4 col-form-label text-md-right">{{ __('Name') }}</label>
<label for="name" class="col-md-4 col-form-label text-md-right">Name</label>
<div class="col-md-6">
<input id="name" type="text" class="form-control @error('name') is-invalid @enderror" name="name" value="{{ old('name') }}" required autocomplete="name" autofocus>
@ -26,7 +26,7 @@
</div>
<div class="form-group row">
<label for="email" class="col-md-4 col-form-label text-md-right">{{ __('E-Mail Address') }}</label>
<label for="email" class="col-md-4 col-form-label text-md-right">E-Mail Addresse</label>
<div class="col-md-6">
<input id="email" type="email" class="form-control @error('email') is-invalid @enderror" name="email" value="{{ old('email') }}" required autocomplete="email">
@ -40,7 +40,7 @@
</div>
<div class="form-group row">
<label for="password" class="col-md-4 col-form-label text-md-right">{{ __('Password') }}</label>
<label for="password" class="col-md-4 col-form-label text-md-right">Passwort</label>
<div class="col-md-6">
<input id="password" type="password" class="form-control @error('password') is-invalid @enderror" name="password" required autocomplete="new-password">
@ -54,7 +54,7 @@
</div>
<div class="form-group row">
<label for="password-confirm" class="col-md-4 col-form-label text-md-right">{{ __('Confirm Password') }}</label>
<label for="password-confirm" class="col-md-4 col-form-label text-md-right">Passwort-Bestätigung</label>
<div class="col-md-6">
<input id="password-confirm" type="password" class="form-control" name="password_confirmation" required autocomplete="new-password">

View file

@ -5,20 +5,20 @@
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">{{ __('Verify Your Email Address') }}</div>
<div class="card-header">E-Mail Adresse bestätigen</div>
<div class="card-body">
@if (session('resent'))
<div class="alert alert-success" role="alert">
{{ __('A fresh verification link has been sent to your email address.') }}
Dir wurde ein Bestätgungs-Link zugemailt.
</div>
@endif
{{ __('Before proceeding, please check your email for a verification link.') }}
{{ __('If you did not receive the email') }},
Bitte überprüfe, ob Du den Bestätigungs-Link per E-Mail erhalten hast.
Wenn Du keine E-Mail erhalten hast,
<form class="d-inline" method="POST" action="{{ route('verification.resend') }}">
@csrf
<button type="submit" class="btn btn-link p-0 m-0 align-baseline">{{ __('click here to request another') }}</button>.
<button type="submit" class="btn btn-link p-0 m-0 align-baseline">klicke hier für einen weiteren Versuch</button>.
</form>
</div>
</div>

View file

@ -6,14 +6,14 @@
<div class="container text-primary mb-3">
<span class="offset-1 col-4 float-left mb-3"><a class="btn btn-success" href="/tour/index_old" class="text-center text-light"><h3>Alte Touren</h3></a></span>
<span class="offset-1"><a href="/pdf/tourenplan.pdf" class="btn btn-success"><h3>Download</h3></a></span>
<span class="offset-1"><a href="/img_storage/pdf/Tourenplan.pdf" class="btn btn-success"><h3>Download</h3></a></span>
</div>
<!--
<div class="row mb-2">
<span class="offset-1 col-4 float-left "><a class="btn btn-success" href="/pdf/tourenplan.pdf" class="text-center text-light"><h3>Alte Touren</h3></a></span>
<span class="offset-3 float-right"><a href="/pdf/tourenplan.pdf" class="text-center text-light"><h3>Download</h3></a></span>
<span class="offset-1 col-4 float-left "><a class="btn btn-success" href="/pdf_storage/tourenplan.pdf_storage" class="text-center text-light"><h3>Alte Touren</h3></a></span>
<span class="offset-3 float-right"><a href="/pdf_storage/tourenplan.pdf_storage" class="text-center text-light"><h3>Download</h3></a></span>
</div>
-->

View file

@ -15,7 +15,7 @@
<p>&nbsp;</p>
<p>
<a class="color-link" href="pdf/mitgliedsantrag.pdf" class="button"> -> Mitgliedsantrag herunterladen <- </a>
<a class="color-link" href="img/pdf/Mitgliedsantrag.pdf" class="button"> -> Mitgliedsantrag herunterladen <- </a>
</p>
</h4>

View file

@ -52,8 +52,10 @@ Route::get('/tour/{tour_id}/join', 'TourController@join')->middleware('auth');
Route::get('/tour/{tour_id}/cancelBooking', 'TourController@cancelBooking')->middleware('auth');
Route::get('/tour/{tour_id}/cancelBookingAdmin/{user_id}', 'TourController@cancelBookingAdmin')->middleware('auth');
Route::get('/img_storage/{category}/{imageName}','ImageController@getImage')->middleware('auth');
Route::get('/img_storage/{category}/{imageName}','ImageController@getImage'); // no middleware auth needed, its checked in Controller
Auth::routes();
/* Cache clearing on remote server */
Route::get('/clear-cache', function() { Artisan::call('cache:clear');Artisan::call('config:clear'); return "Cache cleared, Config reloaded"; });
//Route::get('/home', 'HomeController@index')->name('home');

Binary file not shown.

Binary file not shown.