More changes to use form.select component. Re-engineered user BBS registration

This commit is contained in:
2024-12-06 08:33:24 +11:00
parent fd780d1756
commit e7336a942b
13 changed files with 253 additions and 422 deletions

View File

@@ -49,6 +49,9 @@ class SystemController extends Controller
$o->autohold = FALSE;
$o->save();
if ($o->wasRecentlyCreated)
$o->users()->attach(Auth::id());
$mailers = collect($request->post('mailer_details'))
->filter(function($item) { return $item['port']; })
->transform(function($item) { $item['active'] = Arr::get($item,'active',FALSE); return $item; });
@@ -621,39 +624,19 @@ class SystemController extends Controller
*/
public function register(SystemRegisterRequest $request)
{
if ($request->action === 'register' && $request->name && is_numeric($request->name))
return view('user.system.widget.register_confirm')
->with('o',System::findOrFail($request->name));
// During the BBS linking process, if the user selected a system will link to confirm it
if ($request->action === 'register' && $request->system_id && is_numeric($request->system_id))
return redirect()
->to(sprintf('user/system/register_confirm/%d',$request->system_id));
$o = System::findOrNew(is_numeric($request->system_id) ? $request->system_id : NULL);
// Re-flash our previously input data, we must be creating a new system
session()->flashInput([
'name'=>$request->system_id,
'sysop'=>Auth::user()->name,
]);
// If the system doesnt exist, we'll create it
if (! $o->exist) {
$o->sysop = Auth::user()->name;
foreach (['name','zt_id','location','phone','method','address','port'] as $item)
if ($request->{$item})
$o->{$item} = $request->{$item};
$o->active = TRUE;
}
if ($request->post('submit')) {
Auth::user()->systems()->save($o);
// @todo if the system already exists and part of one of our networks, we'll need to send the registration email to confirm the address.
// @todo mark the system (or addresses) as "pending" at this stage until it is confirmed
return redirect()->to(url('system/addedit',$o->id));
}
// Re-flash our previously input data
if ($request->old)
session()->flashInput($request->old);
return view('system.widget.system')
->with('action',$request->action)
->with('o',$o)
->with('errors',new ViewErrorBag);
return redirect()
->to('system/addedit');
}
/**