mirror of
https://koodu.h-i.works/projects/thebadspace
synced 2025-06-25 16:04:37 -05:00
admin account set up
after the site is installed and the DB set up, there needed to be a way to create the first account that will be used as the admin to access the den, the admin section of tbs the system makes a check to see if this account exists and if there isn't one present, it shows the admin account set up screen on the index. it goes away after the account is created.
This commit is contained in:
@ -151,4 +151,32 @@ class MemberController extends Controller
|
||||
return back()->withErrors(['Nah, you can\'t do this. Wrong permissions.']);
|
||||
}
|
||||
}
|
||||
|
||||
public function adminCreate(Request $request)
|
||||
{
|
||||
//should only be run of no members exist
|
||||
if (count($this->member->getAll()) == 0) {
|
||||
$token = csrf_token();
|
||||
$valid = $request->validate([
|
||||
'handle' => ['required'],
|
||||
'email' => ['required'],
|
||||
'pronouns' => ['required'],
|
||||
'fresh_pass' => ['required'],
|
||||
'fresh_pass_confirm' => ['required'],
|
||||
]);
|
||||
|
||||
if ($valid) {
|
||||
$response = $this->member->add($request);
|
||||
if ($response['status'] == true) {
|
||||
return redirect('/den/member')->with('message', $response['message']);
|
||||
} else {
|
||||
return back()->withErrors([$response['message']]);
|
||||
}
|
||||
} else {
|
||||
return back()->withErrors(['Misssing some required info, homie.']);
|
||||
}
|
||||
} else {
|
||||
return back()->withErrors(['Shame on you for even trying that.']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user