diff --git a/app/Classes/Font.php b/app/Classes/Font.php index dc94f54..9312798 100644 --- a/app/Classes/Font.php +++ b/app/Classes/Font.php @@ -47,23 +47,23 @@ class Font */ private function chars(): Collection { - static $chars = NULL; + static $chars = []; - if (is_null($chars) && $this->text) { + if ($this->text && empty($chars[$this->text])) { // Trim any leading/trailing spaces $text = trim(strtolower($this->text)); - $chars = collect(); + $chars[$this->text] = collect(); // Work out the characters we need foreach (array_unique(str_split($text)) as $c) { if (! $x=Arr::get(static::FONT,$c)) continue; - $chars->put($c,$x); + $chars[$this->text]->put($c,$x); } } - return $chars ?: collect(); + return $chars[$this->text] ?: collect(); } /** @@ -94,7 +94,7 @@ class Font // If the last character is a space, we'll reduce the width $space = TRUE; - foreach ($chars->get($c) as $line => $x) + foreach ($chars->get($c) as $x) if (array_pop($x) != 32) { $space = FALSE; break; diff --git a/app/Console/Commands/UserCodeSend.php b/app/Console/Commands/UserCodeSend.php new file mode 100644 index 0000000..0d65b3f --- /dev/null +++ b/app/Console/Commands/UserCodeSend.php @@ -0,0 +1,32 @@ +argument('ftn')); + $uo = User::where('email',$this->argument('email'))->singleOrFail(); + + Notification::route('netmail',$ao->parent())->notify(new AddressLink($ao,$uo)); + } +} \ No newline at end of file diff --git a/app/Http/Controllers/SystemController.php b/app/Http/Controllers/SystemController.php index d8426ee..9fb2593 100644 --- a/app/Http/Controllers/SystemController.php +++ b/app/Http/Controllers/SystemController.php @@ -556,6 +556,29 @@ class SystemController extends Controller return redirect()->to(sprintf('ftn/system/addedit/%d',$o->system_id)); } + public function system_link(Request $request) + { + if (! $request->system_id) + return redirect('user/system/register'); + + $s = Setup::findOrFail(config('app.id'))->system; + $so = System::findOrFail($request->system_id); + + $ca = NULL; + $la = NULL; + foreach ($s->addresses as $ao) { + if ($ca=$so->match($ao->zone)) + break; + } + + if ($ca->count() && $la=$ca->pop()) + Notification::route('netmail',$la)->notify(new AddressLink($la,Auth::user())); + + return view('user.system.register_send') + ->with('la',$la) + ->with('o',$so); + } + /** * register system */ @@ -565,6 +588,10 @@ class SystemController extends Controller if ($request->isMethod('GET')) return view('user.system.register'); + if ($request->action != 'create') + return view('user.system.widget.register_confirm') + ->with('o',System::findOrFail($request->system_id)); + $o = System::findOrNew($request->system_id); // If the system exists, and we are 'register', we'll start the address claim process @@ -575,7 +602,7 @@ class SystemController extends Controller if ($validate->count()) Notification::route('netmail',$x=$validate->first())->notify(new AddressLink($x,Auth::user())); - return view('user.system.widget.register_confirm') + return view('user.system.widget.register_send') ->with('validate',$validate) ->with('o',$o); } diff --git a/resources/views/user/system/register_send.blade.php b/resources/views/user/system/register_send.blade.php new file mode 100644 index 0000000..2cad49b --- /dev/null +++ b/resources/views/user/system/register_send.blade.php @@ -0,0 +1,28 @@ + +@extends('layouts.app') + +@section('htmlheader_title') + Link System +@endsection + +@section('content') +
+
+
+

Register System

+ + @if($la) +

OK, here's what we are going to do. I'm going to send you a routed netmail to {{ $la->ftn }} with a code - please follow the instructions + in that netmail.

+

Once the code is validated, this system will be assigned to you.

+ @else +

I cant validate that {{ $o->name }} is your system, we dont share common zones.

+

You might want to talk to an admin.

+ @endif + + +

+
+
+
+@endsection \ No newline at end of file diff --git a/resources/views/user/system/widget/register_confirm.blade.php b/resources/views/user/system/widget/register_confirm.blade.php index defd36e..34c65e5 100644 --- a/resources/views/user/system/widget/register_confirm.blade.php +++ b/resources/views/user/system/widget/register_confirm.blade.php @@ -1,13 +1,41 @@ -
+

System Details:

+ + + + + + + + + + + + + + + + + + + + + +
System{{ $o->name }}
Sysop{{ $o->sysop }}
Location{{ $o->location }}
Networks{{ $o->addresses->pluck('ftn')->join(', ') }}
Address{{ $o->access_mailer }}
+ +

If the details are above are not correct, then please contact the (ZC) to have them corrected first.

+ +

Otherwise, if all is good, we'll send a netmail to {{ $o->sysop }} at {{ $o->access_mailer }}

with further details. + + @csrf - @if($validate->count()) -

OK, here's what we are going to do. I'm going to send you a routed netmail with a code - please follow the instructions - in that netmail.

-

Once the code is validated, this system will be assigned to you.

- @else -

I cant validate that {{ $o->name }} is your system, we share now common zones.

-

You might want to talk to an admin.

- @endif -
+ + + +
+
+ +
+
+ \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index e8209fa..f47d9fe 100644 --- a/routes/web.php +++ b/routes/web.php @@ -93,6 +93,7 @@ Route::middleware(['auth','verified','activeuser'])->group(function () { ->where('o','[0-9]+'); Route::match(['get','post'],'user/system/register',[SystemController::class,'system_register']); + Route::match(['post'],'user/system/link',[SystemController::class,'system_link']); }); Route::get('network/{o}',[HomeController::class,'network']);