Fix the fixes
This commit is contained in:
parent
2f6ee03dfc
commit
370b806968
13 changed files with 152 additions and 152 deletions
12
Dockerfile-app
Normal file
12
Dockerfile-app
Normal file
|
@ -0,0 +1,12 @@
|
|||
FROM php:7.3-cli
|
||||
|
||||
RUN docker-php-ext-install mysqli
|
||||
RUN docker-php-ext-install pdo pdo_mysql
|
||||
|
||||
ADD ./ /var/www
|
||||
|
||||
RUN chmod uog+rwx /var/www/storage/logs
|
||||
|
||||
WORKDIR /var/www
|
||||
|
||||
CMD ["php", "artisan", "queue:work"]
|
|
@ -5,6 +5,7 @@ namespace App\Http\Controllers\GUI;
|
|||
use App\Exceptions\HTTPException;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Resources\oAuth\AccessToken;
|
||||
use App\Jobs\Mails\ValidateMailAddressJob;
|
||||
use App\Models\App;
|
||||
use App\Models\Invite;
|
||||
use App\Models\Mail;
|
||||
|
@ -42,6 +43,16 @@ class AdminController extends Controller
|
|||
$settings = Setting::query()->get("*");
|
||||
return view('admin/settings_list', ["settings"=>$settings]);
|
||||
}
|
||||
public function resendValidationMail(Request $request) {
|
||||
if(!Auth::user()->admin) {
|
||||
throw new HTTPException("Need Admin Access");
|
||||
}
|
||||
$mail = Mail::query()->where("id", "=", $request->input("id"))->firstOrFail();
|
||||
|
||||
$this->dispatch(new ValidateMailAddressJob($mail));
|
||||
|
||||
return "OK";
|
||||
}
|
||||
public function saveSettings(Request $request) {
|
||||
if(!Auth::user()->admin) {
|
||||
throw new HTTPException("Need Admin Access");
|
||||
|
|
36
app/Http/Controllers/StatusController.php
Normal file
36
app/Http/Controllers/StatusController.php
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Exceptions\HTTPException;
|
||||
use TaGeSo\APIResponse\Response;
|
||||
|
||||
class StatusController extends Controller
|
||||
{
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
public function check(Response $response) {
|
||||
$pdo = app('db')->getPdo();
|
||||
|
||||
$sth = $pdo->prepare("SELECT * FROM `failed_jobs`");
|
||||
$sth->execute();
|
||||
$res = $sth->fetchAll(\PDO::FETCH_ASSOC);
|
||||
if(count($res) > 0 ){
|
||||
throw new HTTPException(500, "Failed Jobs");
|
||||
}
|
||||
|
||||
|
||||
return $response;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
}
|
|
@ -20,6 +20,8 @@ class ValidateMailAddressJob extends Job
|
|||
$this->mailObject = $mailObject;
|
||||
}
|
||||
|
||||
public $tries = 2;
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
|
@ -45,7 +47,7 @@ class ValidateMailAddressJob extends Job
|
|||
$mail->addBCC($bcc);
|
||||
}
|
||||
$mail->isHTML(true);
|
||||
$mail->Subject = Setting::getSettingValue("name").' E-Mail validation';
|
||||
$mail->Subject = Setting::getSettingValue("name_big").Setting::getSettingValue("name_small").' E-Mail validation';
|
||||
$mail->Body = 'Hello,<br>to validate your E-Mail address click on the following link: <a href="'.Setting::getSettingValue('url').'/gui/mailValidation/'.$this->mailObject->id.'/'.$this->mailObject->validation_code.'">Activate Account</a>';
|
||||
$mail->AltBody = 'Hello,\r\nto validate your E-Mail address click on the following link: '.Setting::getSettingValue('url').'/gui/mailValidation/'.$this->mailObject->id.'/'.$this->mailObject->validation_code;
|
||||
$mail->send();
|
||||
|
|
5
build.sh
5
build.sh
|
@ -1,4 +1,7 @@
|
|||
rm -r -f storage/logs/l*
|
||||
chmod uog+rwx storage/logs
|
||||
docker build -t docker.keks.cloud/keksaccount/web:latest .
|
||||
docker build -t docker.keks.cloud/keksaccount/web:latest -f Dockerfile-app .
|
||||
docker build -t docker.keks.cloud/keksaccount/app:latest -f Dockerfile-app .
|
||||
|
||||
docker push docker.keks.cloud/keksaccount/web:latest
|
||||
docker push docker.keks.cloud/keksaccount/app:latest
|
||||
|
|
36
database/migrations/2019_07_10_143516_create_jobs_table.php
Normal file
36
database/migrations/2019_07_10_143516_create_jobs_table.php
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateJobsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('jobs', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('queue')->index();
|
||||
$table->longText('payload');
|
||||
$table->unsignedTinyInteger('attempts');
|
||||
$table->unsignedInteger('reserved_at')->nullable();
|
||||
$table->unsignedInteger('available_at');
|
||||
$table->unsignedInteger('created_at');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class CreateFailedJobsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
}
|
|
@ -1,15 +1,23 @@
|
|||
version: '3'
|
||||
services:
|
||||
webapp:
|
||||
build: ./
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: Dockerfile-web
|
||||
volumes:
|
||||
- ./:/var/www
|
||||
ports:
|
||||
- 8000:80
|
||||
app:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: Dockerfile-app
|
||||
volumes:
|
||||
- ./:/var/www
|
||||
mysql:
|
||||
image: mysql:5.7
|
||||
ports:
|
||||
- 3366:3306
|
||||
- 3306:3306
|
||||
environment:
|
||||
MYSQL_ROOT_PASSWORD: example
|
||||
MYSQL_DATABASE: oauth
|
||||
|
|
147
kube.yml
147
kube.yml
|
@ -1,147 +0,0 @@
|
|||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: env-keksaccount-web
|
||||
namespace: keksaccount
|
||||
data:
|
||||
APP_DEBUG: "false"
|
||||
DB_CONNECTION: "mysql"
|
||||
DB_HOST: "mysql"
|
||||
DB_PORT: "3306"
|
||||
DB_PORT: "oauth"
|
||||
DB_USERNAME: "oauth"
|
||||
DB_PASSWORD: "oauth"
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: secret-keksaccount-mysql
|
||||
namespace: keksaccount
|
||||
type: Opaque
|
||||
data:
|
||||
MYSQL_ROOT_PASSWORD: dGlmaW1hZG9ja2Vy
|
||||
MYSQL_DATABASE: b2F1dGg=
|
||||
MYSQL_USER: b2F1dGg=
|
||||
MYSQL_PASSWORD: b2F1dGg=
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: keksaccount
|
||||
namespace: keksaccount
|
||||
spec:
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: keksaccount
|
||||
spec:
|
||||
containers:
|
||||
- name: web
|
||||
image: docker.keks.cloud/keksaccount/web:latest
|
||||
ports:
|
||||
- containerPort: 80
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: env-keksaccount-web
|
||||
imagePullSecrets:
|
||||
- name: docker-keks-cloud
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
annotations:
|
||||
field.cattle.io/targetWorkloadIds: '["deployment:keksaccount:keksaccount"]'
|
||||
name: ingress-keksaccount
|
||||
namespace: keksaccount
|
||||
spec:
|
||||
ports:
|
||||
- port: 80
|
||||
protocol: TCP
|
||||
targetPort: 80
|
||||
type: ClusterIP
|
||||
status:
|
||||
loadBalancer: {}
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: mysql
|
||||
namespace: keksaccount
|
||||
spec:
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: mysql
|
||||
spec:
|
||||
containers:
|
||||
- name: mysql
|
||||
image: mysql:5.6
|
||||
ports:
|
||||
- containerPort: 3306
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: secret-keksaccount-mysql
|
||||
volumeMounts:
|
||||
- mountPath: /var/lib/mysql
|
||||
name: mysql
|
||||
volumes:
|
||||
- name: mysql
|
||||
persistentVolumeClaim:
|
||||
claimName: mysql
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
annotations:
|
||||
field.cattle.io/targetWorkloadIds: '["deployment:keksaccount:mysql"]'
|
||||
name: mysql
|
||||
namespace: keksaccount
|
||||
spec:
|
||||
ports:
|
||||
- port: 3306
|
||||
protocol: TCP
|
||||
targetPort: 3306
|
||||
type: ClusterIP
|
||||
status:
|
||||
loadBalancer: {}
|
||||
---
|
||||
apiVersion: certmanager.k8s.io/v1alpha1
|
||||
kind: Certificate
|
||||
metadata:
|
||||
name: account.keks.cloud
|
||||
namespace: keksaccount
|
||||
spec:
|
||||
secretName: account-keks-cloud-tls
|
||||
acme:
|
||||
config:
|
||||
- dns01:
|
||||
provider: cf-dns
|
||||
domains:
|
||||
- 'account.keks.cloud'
|
||||
commonName: 'account.keks.cloud'
|
||||
dnsNames:
|
||||
- account.keks.cloud
|
||||
issuerRef:
|
||||
kind: ClusterIssuer
|
||||
name: letsencrypt-prod
|
||||
|
||||
---
|
||||
apiVersion: extensions/v1beta1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: keksaccount
|
||||
namespace: keksaccount
|
||||
spec:
|
||||
rules:
|
||||
- host: account.keks.cloud
|
||||
http:
|
||||
paths:
|
||||
- backend:
|
||||
serviceName: ingress-keksaccount
|
||||
servicePort: 80
|
||||
path: /
|
||||
tls:
|
||||
- secretName: account-keks-cloud-tls
|
|
@ -44,6 +44,7 @@
|
|||
if($mail->status == "waiting") {
|
||||
echo '<a href="/gui/mailValidation/'.$mail->id.'/'.$mail->validation_code.'" class="btn btn-danger btn-sm">Aktivieren</a>';
|
||||
}
|
||||
echo '<a href="/gui/admin/resendInviteMail?id='.$mail->id.'" class="btn btn-warning btn-sm">Resend Validation Mail</a>';
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
1
routes/test
Normal file
1
routes/test
Normal file
|
@ -0,0 +1 @@
|
|||
curl 'http://localhost:8000/api/v1/user/register' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:67.0) Gecko/20100101 Firefox/67.0' -H 'Accept: */*' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Referer: http://localhost:8000/gui/register?invite=KrAWOlMaJOGEWNMrN6jO' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'X-Requested-With: XMLHttpRequest' -H 'Connection: keep-alive' -H 'Cookie: DOKU_PREFS=ext_enabled%231%23ext_disabled%231%23ext_updatable%231; DokuWiki=457d4e3dd81951e4a220b1a968daf6c5; DW68700bfd16c2027de7de74a5a8202a6f=c29lcmVu%7C0%7CSlpEYBEUM3HZF6SzyKe80M6kD3Lc%2Bby2VPiX6AYVcd8%3D; PHPSESSID=2f124bd5695f0521bc330c912bfd1a30' -H 'Pragma: no-cache' -H 'Cache-Control: no-cache' --data 'invite=KrAWOlMaJOGEWNMrN6jO&username=registerfailed&password=gelnhausen&mail=soeren%40siegismund-poschmann.de'
|
|
@ -73,6 +73,7 @@ $router->post("api/v1/user/register", ['uses' => 'API\UserController@register'])
|
|||
$router->get("api/v1/user/captcha", ['uses' => 'API\UserController@reCAPTCHA']);
|
||||
$router->get("api/v1/user/invites", ['uses' => 'API\UserController@getInviteCodeInfo']);*/
|
||||
$router->get("api/v1/server/settings", ["uses" => "API\ServerController@getSettings"]);
|
||||
$router->get("status/check", ["uses" => "StatusController@check"]);
|
||||
|
||||
$router->group(['prefix' => 'gui', 'middleware' => 'gui'], function () use ($router) {
|
||||
$router->get('/register', ['uses' => 'GUI\AccountController@registerView']);
|
||||
|
@ -110,6 +111,7 @@ $router->group(['prefix' => 'gui', 'middleware' => 'gui'], function () use ($rou
|
|||
$router->get("/admin/users", ["uses" => 'GUI\AdminController@listUser']);
|
||||
$router->get("/admin/users/{id}", ["uses" => 'GUI\AdminController@userDetails']);
|
||||
$router->post("/admin/users/{id}", ["uses" => 'GUI\AdminController@saveUserDetails']);
|
||||
$router->get("/admin/resendInviteMail", ["uses" => 'GUI\AdminController@resendValidationMail']);
|
||||
|
||||
|
||||
|
||||
|
|
Reference in a new issue