Exemplo n.º 1
0
 /**
  * test for deleting users data [delete user 3 & 4]
  *
  * @return void
  */
 public function testDelete()
 {
     users::where('email', '*****@*****.**')->delete();
     users::where('email', '*****@*****.**')->delete();
     $this->dontSeeInDatabase('users', ['email' => '*****@*****.**']);
     $this->dontSeeInDatabase('users', ['email' => '*****@*****.**']);
 }
Exemplo n.º 2
0
 public function remove_image($id)
 {
     $dados = users::findOrfail($id);
     if (!\File::delete(public_path() . '/images/users/' . $dados->path_foto)) {
         \Session::flash('flash_message_erros', 'Erro ao remover imagem');
     } else {
         $dados->path_foto = '';
         $dados->save();
         \Session::flash('flash_message', 'Imagem Removida com Sucesso!!!');
     }
     return redirect('usuarios');
 }
Exemplo n.º 3
0
    $view = $app->view();
    $view->setTemplatesDirectory(TEMPLATE_ADMIN);
    $customer = customers::where('id', $id);
    $albums = albums::find('all', array('order' => 'name asc'));
    $albumsCustomers = albumsCustomers::where('customers_id', $id, 'all');
    $join = "JOIN albums_customers a ON(albums.id = a.albums_id) WHERE customers_id = {$id}";
    // $manages = albums::all(array('joins' => $join));
    $manages = albums::find_by_sql("SELECT a.id as ab, albums.name, albums.cover FROM albums JOIN albums_customers a ON ( albums.id = a.albums_id ) WHERE customers_id = {$id}");
    $dados = array('pagina' => 'albums_customer', 'albums' => $albums, 'customer' => $customer, 'users' => $users, 'albumsCustomers' => $albumsCustomers, 'manages' => $manages);
    $app->render('layout.php', $dados);
});
$app->post('/admin/customers/albums_manage/album_add', function () use($app) {
    login::estaLogado('user_logado', $app);
    $users = users::where('name', $_SESSION['name']);
    $customer = $app->request()->post('customer');
    $album = $app->request()->post('album');
    $attributes = array('customers_id' => $customer, 'albums_id' => $album);
    albumsCustomers::cadastrar($attributes);
    $app->flash('sucesso', 'Relação cadastrada com sucesso !');
    $app->redirect("/admin/customers/albums_manage/{$customer} ");
});
$app->delete('/admin/customers/albums_manage/album_del/:id', function ($id) use($app) {
    login::estaLogado('user_logado', $app);
    $users = users::where('name', $_SESSION['name']);
    $id = filter_var($id, FILTER_SANITIZE_NUMBER_INT);
    albumsCustomers::deletar($id);
    // $images = new images();
    //
    // $images->deletar($id);
    // echo 'deletou';
});
 private static function accountExists($userProfile, $provider)
 {
     $user = users::findFirst(array(array('oauthUID' => $userProfile->identifier, 'oauthProvider' => $provider)));
     return $user->uid;
 }
Exemplo n.º 5
0
 function userEmailbyID($id)
 {
     $user = users::where('id', '=', $id)->firstOrFail();
     return $user->email;
 }
Exemplo n.º 6
0
 public function getUserWithEmail($email)
 {
     return users::findFirst(array(array("email" => (string) $email)));
 }
Exemplo n.º 7
0
use app\models\users;
use app\classes\hash;
$app->map('/logar', function () use($app) {
    if ($app->request()->isGet()) {
        $template = $twig->loadTemplate('home.html');
        $template->display($dados);
    } else {
        $view = $app->view();
        $view->setTemplatesDirectory(TEMPLATE_ADMIN);
        $email = $app->request()->post('email');
        $pass = $app->request()->post('pass');
        $validation = new validation();
        $validacoes = array('email' => 'obrigatorio|email', 'pass' => 'obrigatorio');
        $validar = $validation->validar($_POST, $validacoes);
        if ($validar) {
            $user = new users();
            $user->setCampos(array('email', 'password'));
            $logado = $user->logar($email, hash::hash($pass));
            if (count($logado) == 1) {
                $_SESSION['user_logado'] = true;
                $_SESSION['name'] = $logado->name;
                $_SESSION['id'] = $logado->id;
                $app->redirect('/painel');
            } else {
                $erros = array('erro' => 'Usuário ou senha incorretos');
            }
        } else {
            $erros = array('erro' => $validation->mostrarErros());
        }
        $app->render('login.php', $erros);
    }
Exemplo n.º 8
0
 /**
  * Excluir registro do banco.
  *
  * @param    int  $id
  * @return  \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     //Apaga tabela USERS
     $dados = users::findOrfail($id);
     $dados->delete();
     //Apaga tabela USUARIOS_GRUPO
     $where = ['usuarios_empresas_clientes_cloud_id' => $this->dados_login->empresas_clientes_cloud_id, 'usuarios_id' => $id];
     \DB::table('usuarios_grupo')->where($where)->delete();
     //Apaga tabela USUARIOS
     $where = ['empresas_clientes_cloud_id' => $this->dados_login->empresas_clientes_cloud_id, 'id' => $id];
     \DB::table('usuarios')->where($where)->delete();
     return redirect('login_membros');
 }
 /**
  * Submit function of the Users Page.
  *
  * @return \Illuminate\Http\Response
  */
 public function SettingsSubmit(Request $request)
 {
     $input = $request->all();
     $UserId = Auth::user()->id;
     $Name = $input['Name'];
     $Email = $input['Email'];
     $Telephone = $input['Telephone'];
     $Password = $input['password'];
     $RePassword = $input['password_confirmation'];
     //create validation array
     if ($Password == "") {
         $rules = array('Name' => 'regex:/(^[A-Za-z ]+$)+/', 'Email' => 'required|email', 'Telephone' => 'regex:/(^\\(?0\\d{2}\\)?[\\s\\-]?\\d{7}$)+/');
     } else {
         $rules = array('Name' => 'regex:/(^[A-Za-z ]+$)+/', 'Email' => 'required|email', 'Telephone' => 'regex:/(^\\(?0\\d{2}\\)?[\\s\\-]?\\d{7}$)+/', 'password' => 'required|min:6|confirmed');
     }
     // $messages = [
     //       'b_name.required' => 'please fill Broadcast Name field',
     //       'base_size.required' => 'please fill Base Size field',
     //       'base_size.integer' => 'Please insert integer',
     //       'date.required' => 'please fill Broadcast Date',
     //       'start_date.date' => 'Please insert valid start_date format',
     //       'end_date.date' => 'Please insert valid end_date format',
     //   ];
     //use validation class
     $validation = Validator::make($input, $rules);
     //if validation fails, redirect.
     if ($validation->fails()) {
         return redirect('dashboard/settings')->withErrors($validation)->withInput();
     }
     try {
         if ($Password == "") {
             users::where('id', $UserId)->update(['name' => $Name, 'Email' => $Email, 'telephone' => $Telephone]);
             return redirect('dashboard/settings')->with('message', 'Your settings have been updated Successfully.')->with('type', 'success')->with('title', 'Settings Saved!');
         } else {
             users::where('id', $UserId)->update(['name' => $Name, 'Email' => $Email, 'telephone' => $Telephone, 'password' => bcrypt($Password)]);
             return redirect('dashboard/settings')->with('message', 'Your settings have been updated Successfully.')->with('type', 'success')->with('title', 'Settings Saved!');
         }
     } catch (\Illuminate\Database\QueryException $e2) {
         return redirect('dashboard/settings')->with('message', 'Failed to update!')->with('type', 'error')->with('title', 'Error');
     }
 }
 /**
  * test for deleting users data
  *
  * @return void
  */
 public function testDelete()
 {
     //delete record
     ClientList::where('email', '*****@*****.**')->delete();
     users::where('email', '*****@*****.**')->delete();
     ClientList::where('email', '*****@*****.**')->delete();
     users::where('email', '*****@*****.**')->delete();
     ClientList::where('email', '*****@*****.**')->delete();
     users::where('email', '*****@*****.**')->delete();
     //assert records are not in database
     $this->dontSeeInDatabase('clients', ['email' => '*****@*****.**']);
     $this->dontSeeInDatabase('clients', ['email' => '*****@*****.**']);
     $this->dontSeeInDatabase('clients', ['email' => '*****@*****.**']);
 }
Exemplo n.º 11
0
 function searchRaw($query)
 {
     return users::whereRaw("concat(firstName, ' ', lastName) like '%{$query}%'")->get();
 }
Exemplo n.º 12
0
    $old_pass = $app->request()->post('old-pass');
    $pass = $app->request()->post('pass');
    $conf_pass = $app->request()->post('conf-pass');
    $validation = new validation();
    $validacoes = array('old-pass' => 'obrigatorio', 'pass' => 'obrigatorio', 'conf-pass' => 'obrigatorio');
    $validar = $validation->validar($_POST, $validacoes);
    if ($pass != $conf_pass) {
        $app->flash('erro', 'As senhas não conferem. Digite novamente.');
        $app->redirect('/admin/configuration');
    } else {
        if ($validar) {
            $user = new users();
            $user->setCampos(array('id', 'password'));
            $logado = $user->logar($id, hash::hash($old_pass));
            if (count($logado) == 1) {
                $attributes = array('password' => hash::hash($pass));
                $user = new users();
                $user->atualizar($id, $attributes);
                $app->flash('sucesso', 'Dados do cliente alterados com sucesso !');
                $app->redirect('/admin/configuration');
            } else {
                $app->flash('erro', 'Senha não confere com a cadastrada');
                $app->redirect('/admin/configuration');
            }
        } else {
            $app->flash('erro', $validation->mostrarErros());
            $app->flash('nameAlbum', $name);
            $app->redirect('/admin/configuration');
        }
    }
});
Exemplo n.º 13
0
 /**
  * Deactivates an account
  *
  * @param  array  $data
  * @return \Illuminate\Contracts\Validation\Validator
  */
 public function deactivate()
 {
     users::destroy(Auth::User()->id);
     Auth::logout();
     return redirect('login')->with('message', 'Your account has been deleted successfully!')->with('type', 'success')->with('title', 'Account Deleted');
 }
Exemplo n.º 14
0
 /**
  * Description : load data from select 'local of meeting'
  * @return var JSON
  */
 public function loadSelect()
 {
     $users = \App\Models\users::select('id', 'name')->get();
     return json_encode($users);
 }