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') +
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 + + + +