diff --git a/.env.example b/.env.example
index d058c34..43f02c4 100644
--- a/.env.example
+++ b/.env.example
@@ -5,6 +5,7 @@ APP_DEBUG=true
APP_URL=http://localhost
LOG_CHANNEL=stack
+TIMEZONE=Europe/Vienna
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php
index 0b18b50..278bf82 100644
--- a/app/Http/Controllers/AdminController.php
+++ b/app/Http/Controllers/AdminController.php
@@ -10,6 +10,7 @@
use App\Admin;
use Hash;
use App\Alias;
+use App\Invite;
class AdminController extends Controller
{
@@ -46,7 +47,9 @@ public function showAliases(Request $request){
}
public function showInvites(Request $request){
- return view('showinvites');
+ $invites = Invite::with('domain')->get();
+ $domains = Domain::all();
+ return view('showinvites', [ 'invites' => $invites, 'domains' => $domains ]);
}
public function changePassword(Request $request){
@@ -165,4 +168,35 @@ public function deleteAlias(Request $request){
return redirect(route('Admin.showAliases'));
}
+
+// --- INVITE ---
+
+ public function addInvite(Request $request){
+ $invite = new Invite();
+ do {
+ $invite->token = str_replace('.', '0', str_replace('/', '0', substr(Hash::make('Lelouch'), 7, -3)));
+ } while(Invite::where('token', $invite->token)->count()>0);
+ if(isset($request->name_preset)){
+ $invite->name_preset = $request->name_preset;
+ }
+ $invite->termination_date = $request->termination_date.' '.$request->termiantion_time;
+ $invite->domain_id = $request->domain_id;
+ $invite->save();
+
+ return redirect(route('Admin.showInvites'));
+ }
+
+ public function updateInvite(Request $request){
+ $invite = Invite::findOrFail($request->id);
+ // not needed yet
+ $invite->save();
+
+ return redirect(route('Admin.showInvites'));
+ }
+
+ public function deleteInvite(Request $request){
+ Invite::destroy($request->id);
+
+ return redirect(route('Admin.showInvites'));
+ }
}
diff --git a/config/app.php b/config/app.php
index 2b1ecd4..8932b48 100644
--- a/config/app.php
+++ b/config/app.php
@@ -67,7 +67,7 @@
|
*/
- 'timezone' => 'UTC',
+ 'timezone' => env('TIMEZONE', 'UTC'),
/*
|--------------------------------------------------------------------------
diff --git a/resources/views/showaliases.blade.php b/resources/views/showaliases.blade.php
index 1e3675e..31b21b9 100644
--- a/resources/views/showaliases.blade.php
+++ b/resources/views/showaliases.blade.php
@@ -82,12 +82,13 @@
-
diff --git a/resources/views/showinvites.blade.php b/resources/views/showinvites.blade.php
new file mode 100644
index 0000000..91259a5
--- /dev/null
+++ b/resources/views/showinvites.blade.php
@@ -0,0 +1,118 @@
+
+
+
+ MailMan - Invites
+@include('headdata')
+
+
+@include('cookieConsent::index')
+@include('navbar')
+
+
+
+
+
Invites {{ date('Y-m-d H:i:s') }}
+
+
+
+
+
+
+
+
+ Invite link |
+ Name preset |
+ Domain |
+ Date of termination |
+ Options |
+
+
+
+ @foreach($invites as $invite)
+
+ Link |
+ @if($invite->name_preset === NULL) - @else {{ $invite->name_preset }} @endif |
+ {{ $invite->domain->name }} |
+ {{ $invite->termination_date }} |
+
+
+ |
+
+ @endforeach
+
+
+
+
+
+
+@include('footer')
+
+
+
+
+
+