Skip to content
This repository was archived by the owner on Mar 24, 2024. It is now read-only.

Commit 2a792a5

Browse files
committed
Merge pull request #11 from lbausch/development
Version 2.0
2 parents ab53769 + d17a0c5 commit 2a792a5

File tree

132 files changed

+4185
-2579
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+4185
-2579
lines changed

.env.example

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
APP_ENV=production
22
APP_DEBUG=false
3-
APP_URL=http://localhost:8000
4-
APP_TIMEZONE=Europe/Berlin
53
APP_KEY=SomeRandomString
4+
APP_URL=http://localhost
5+
APP_TIMEZONE=Europe/Berlin
6+
APP_LOG=daily
67

7-
# database for SQLgreyGUI
8-
# if you want to use a single database for both SQLgreyGUI and SQLgrey
9-
# use only this config block
8+
# Database for SQLgreyGUI
9+
# If you want to use a single database for both SQLgreyGUI and SQLgrey use only this config block
10+
DB_CONNECTION=mysql
1011
DB_HOST=localhost
12+
DB_PORT=3306
1113
DB_DATABASE=sqlgrey
1214
DB_USERNAME=sqlgrey
1315
DB_PASSWORD=sqlgrey
1416

1517
# Uncomment the following lines if SQLgrey resides in a different database
18+
#SQLGREY_DB_CONNECTION=mysql
1619
#SQLGREY_DB_HOST=null
20+
#SQLGREY_DB_PORT=3306
1721
#SQLGREY_DB_DATABASE=null
1822
#SQLGREY_DB_USERNAME=null
1923
#SQLGREY_DB_PASSWORD=null
@@ -22,7 +26,11 @@ CACHE_DRIVER=file
2226
SESSION_DRIVER=file
2327
QUEUE_DRIVER=sync
2428

25-
MAIL_DRIVER=mail
29+
REDIS_HOST=127.0.0.1
30+
REDIS_PASSWORD=null
31+
REDIS_PORT=6379
32+
33+
MAIL_DRIVER=log
2634
MAIL_HOST=mailtrap.io
2735
MAIL_PORT=2525
2836
MAIL_USERNAME=null

.gitignore

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
/vendor
22
/node_modules
3+
/public/storage
34
Homestead.yaml
45
Homestead.json
56
.env
67

7-
## PhpStorm
8-
.idea/
8+
## Development
9+
/.idea/
10+
/.vagrant/
11+
.phpstorm.meta.php
12+
_ide_helper.php
13+
_ide_helper_models.php
914

1015
## Assets
1116
/public/assets/min

.travis.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
language: php
2+
3+
php:
4+
- '5.5'
5+
- '5.6'
6+
- '7.0'
7+
8+
install:
9+
- ./ci/setup_environment.sh
10+
11+
script: ./ci/run_tests.sh

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2014 - 2015 Lorenz Bausch
3+
Copyright (c) 2014 - 2016 Lorenz Bausch
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
SQLgreyGUI
22
==========
33

4-
Web interface for [SQLgrey](http://sqlgrey.sourceforge.net/) using the [Laravel 5](http://laravel.com/) Framework.
4+
[![Build Status](https://travis-ci.org/lbausch/SQLgreyGUI.svg?branch=master)](https://travis-ci.org/lbausch/SQLgreyGUI)
5+
6+
Web interface for [SQLgrey](http://sqlgrey.sourceforge.net/) using the [Laravel 5](https://laravel.com/) Framework.
57

68
## Features
79
* Dashboard: quick overview of emails / domains in greylist, whitelist, opt-out and opt-in
@@ -22,7 +24,7 @@ Web interface for [SQLgrey](http://sqlgrey.sourceforge.net/) using the [Laravel
2224
1. grab a copy of the code (download [master.zip](https://github.com/lbausch/SQLgreyGUI/archive/master.zip) or use `git clone https://github.com/lbausch/SQLgreyGUI.git`)
2325
2. make your webserver use the `public` directory as document root
2426
3. copy `.env.example` to `.env` and adjust it to your needs (`APP_URL`, `APP_TIMEZONE`, `APP_KEY` and database settings)
25-
4. run `composer install` to install all necessary dependencies
27+
4. run `composer install --no-dev` to install all necessary dependencies
2628
5. set a new application key with `php artisan key:generate`
2729
6. run `php artisan migrate --seed --force` to create the database tables and an admin user
2830
7. login with the username `admin` and the password `joh316` (you can change the password in "Settings")
@@ -31,3 +33,5 @@ Web interface for [SQLgrey](http://sqlgrey.sourceforge.net/) using the [Laravel
3133
## Screenshots
3234
![Dasboard](/../screenshots/dashboard.png?raw=true "Dashboard")
3335
![Auto-Whitelist](/../screenshots/auto-whitelist.png?raw=true "Auto-Whitelist")
36+
37+
Follow [SQLgreyGUI](https://twitter.com/sqlgreygui) on Twitter

Vagrantfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
require 'json'
2+
require 'yaml'
3+
4+
VAGRANTFILE_API_VERSION ||= "2"
5+
confDir = $confDir ||= File.expand_path("vendor/laravel/homestead", File.dirname(__FILE__))
6+
7+
homesteadYamlPath = "Homestead.yaml"
8+
homesteadJsonPath = "Homestead.json"
9+
afterScriptPath = "after.sh"
10+
aliasesPath = "aliases"
11+
12+
require File.expand_path(confDir + '/scripts/homestead.rb')
13+
14+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
15+
if File.exists? aliasesPath then
16+
config.vm.provision "file", source: aliasesPath, destination: "~/.bash_aliases"
17+
end
18+
19+
if File.exists? homesteadYamlPath then
20+
Homestead.configure(config, YAML::load(File.read(homesteadYamlPath)))
21+
elsif File.exists? homesteadJsonPath then
22+
Homestead.configure(config, JSON.parse(File.read(homesteadJsonPath)))
23+
end
24+
25+
if File.exists? afterScriptPath then
26+
config.vm.provision "shell", path: afterScriptPath
27+
end
28+
end

app/Exceptions/Handler.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
namespace SQLgreyGUI\Exceptions;
44

55
use Exception;
6+
use Illuminate\Validation\ValidationException;
7+
use Illuminate\Auth\Access\AuthorizationException;
68
use Illuminate\Database\Eloquent\ModelNotFoundException;
79
use Symfony\Component\HttpKernel\Exception\HttpException;
8-
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
910
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
1011

1112
class Handler extends ExceptionHandler
@@ -16,8 +17,10 @@ class Handler extends ExceptionHandler
1617
* @var array
1718
*/
1819
protected $dontReport = [
20+
AuthorizationException::class,
1921
HttpException::class,
2022
ModelNotFoundException::class,
23+
ValidationException::class,
2124
];
2225

2326
/**
@@ -29,7 +32,7 @@ class Handler extends ExceptionHandler
2932
*/
3033
public function report(Exception $e)
3134
{
32-
return parent::report($e);
35+
parent::report($e);
3336
}
3437

3538
/**
@@ -42,10 +45,6 @@ public function report(Exception $e)
4245
*/
4346
public function render($request, Exception $e)
4447
{
45-
if ($e instanceof ModelNotFoundException) {
46-
$e = new NotFoundHttpException($e->getMessage(), $e);
47-
}
48-
4948
return parent::render($request, $e);
5049
}
5150
}

app/Http/Controllers/AboutController.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@
44

55
class AboutController extends Controller
66
{
7-
/**
8-
* Constructor.
9-
*/
10-
public function __construct()
11-
{
12-
parent::__construct();
13-
}
14-
157
/**
168
* Index.
179
*
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<?php
2+
3+
namespace SQLgreyGUI\Http\Controllers\Auth;
4+
5+
use SQLgreyGUI\Models\User;
6+
use Validator;
7+
use SQLgreyGUI\Http\Controllers\Controller;
8+
use Illuminate\Http\Request;
9+
use Illuminate\Foundation\Auth\ThrottlesLogins;
10+
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
11+
12+
class AuthController extends Controller
13+
{
14+
/*
15+
|--------------------------------------------------------------------------
16+
| Registration & Login Controller
17+
|--------------------------------------------------------------------------
18+
|
19+
| This controller handles the registration of new users, as well as the
20+
| authentication of existing users. By default, this controller uses
21+
| a simple trait to add these behaviors. Why don't you explore it?
22+
|
23+
*/
24+
25+
use AuthenticatesAndRegistersUsers, ThrottlesLogins;
26+
27+
/**
28+
* Where to redirect users after login / registration.
29+
*
30+
* @var string
31+
*/
32+
protected $redirectTo = '/';
33+
34+
/**
35+
* Login username to be used by the controller.
36+
*
37+
* @var string
38+
*/
39+
protected $username = 'username';
40+
41+
/**
42+
* Create a new authentication controller instance.
43+
*/
44+
public function __construct()
45+
{
46+
$this->middleware($this->guestMiddleware(), ['except' => 'logout']);
47+
}
48+
49+
/**
50+
* Get the needed authorization credentials from the request.
51+
*
52+
* @param \Illuminate\Http\Request $request
53+
*
54+
* @return array
55+
*/
56+
protected function getCredentials(Request $request)
57+
{
58+
$data = $request->only($this->loginUsername(), 'password');
59+
$data['enabled'] = true;
60+
61+
return $data;
62+
}
63+
64+
/**
65+
* Get a validator for an incoming registration request.
66+
*
67+
* @param array $data
68+
*
69+
* @return \Illuminate\Contracts\Validation\Validator
70+
*/
71+
protected function validator(array $data)
72+
{
73+
return Validator::make($data, [
74+
'name' => 'required|max:255',
75+
'email' => 'required|email|max:255|unique:users',
76+
'password' => 'required|min:6|confirmed',
77+
]);
78+
}
79+
80+
/**
81+
* Create a new user instance after a valid registration.
82+
*
83+
* @param array $data
84+
*
85+
* @return User
86+
*/
87+
protected function create(array $data)
88+
{
89+
return User::create([
90+
'name' => $data['name'],
91+
'email' => $data['email'],
92+
'password' => bcrypt($data['password']),
93+
]);
94+
}
95+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Auth;
4+
5+
use App\Http\Controllers\Controller;
6+
use Illuminate\Foundation\Auth\ResetsPasswords;
7+
8+
class PasswordController extends Controller
9+
{
10+
/*
11+
|--------------------------------------------------------------------------
12+
| Password Reset Controller
13+
|--------------------------------------------------------------------------
14+
|
15+
| This controller is responsible for handling password reset requests
16+
| and uses a simple trait to include this behavior. You're free to
17+
| explore this trait and override any methods you wish to tweak.
18+
|
19+
*/
20+
21+
use ResetsPasswords;
22+
23+
/**
24+
* Create a new password controller instance.
25+
*/
26+
public function __construct()
27+
{
28+
$this->middleware('guest');
29+
}
30+
}

app/Http/Controllers/AuthController.php

Lines changed: 0 additions & 70 deletions
This file was deleted.

0 commit comments

Comments
 (0)