This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
vbbs/app/Classes/Frame/Action/Register.php
2019-07-14 22:43:31 +10:00

47 lines
1.0 KiB
PHP

<?php
namespace App\Classes\Frame\Action;
use App\User;
use App\Classes\Frame\Action;
/**
* Class Register
* This handles the data received for account registration
*
* @package App\Classes\Frame\Action
*/
class Register extends Action
{
/**
* Handle user logins
*
* @param array $fielddata
* @return bool
*/
public function handle()
{
$o = new User;
try {
$o->login = $this->so->fo->getFieldDataId(0);
$o->name = $this->so->fo->getFieldDataId(1);
$o->email = $this->so->fo->getFieldDataId(2);
$o->password = $this->so->fo->getFieldDataId(3);
$o->location = $this->so->fo->getFieldDataId(5);
$o->save();
$this->so->sendBaseline($this->so->co,GREEN.'ACCOUNT CREATED, PRESS '.HASH.' TO CONTINUE...'.WHITE);
$this->state['action'] = ACTION_NEXT;
// Add to CUG 0
$o->cugs()->attach(0);
} catch (\Exception $e) {
$this->so->sendBaseline($this->so->co,RED.'SOMETHING WENT WRONG...'.WHITE);
$this->so->log('error',$e->getMessage());
$this->state['action'] = ACTION_RELOAD;
}
}
}