Exemplo n.º 1
0
 protected function _create()
 {
     try {
         $data = $this->_get_user_data();
         $user = new ExtraUser(null);
         $user->id = $user->create(array_replace($data, array('password' => Secure::password($data['password'], $data['username']))));
         (new NotifyPartnerAccount())->register($user->id, $data['password']);
         Alert::once('success', 'Account created successfully!', Url::current());
     } catch (\Exception $e) {
         Alert::once('error', $e->getCode() == 11000 ? 'Username already exists' : $e->getMessage(), Url::current());
     }
 }