diff --git a/.env.example b/.env.example index 60a7906..7a32de4 100644 --- a/.env.example +++ b/.env.example @@ -3,6 +3,7 @@ APP_ENV=local APP_KEY= APP_DEBUG=true APP_URL=http://localhost +APP_ID = 3 PROXY_URL= PROXY_SCHEME= @@ -48,5 +49,7 @@ JWT_SECRET= GOOGLE_DRIVE_TASKS_FOLDER_ID= +API_URL=http://localhost:8002/ + LOGIN_ATTEMPTS=5 TIMEOUT_LOGIN=30 diff --git a/app/Model/User.php b/app/Model/User.php index 5fb398b..2d9b174 100644 --- a/app/Model/User.php +++ b/app/Model/User.php @@ -3,10 +3,12 @@ namespace App\Model; use App\Model\Order; +use Carbon\Carbon; use Illuminate\Support\Str; use Illuminate\Notifications\Notifiable; use Illuminate\Foundation\Auth\User as Authenticatable; use Tymon\JWTAuth\Contracts\JWTSubject; +use Firebase\JWT\JWT; class User extends Authenticatable implements JWTSubject { @@ -122,4 +124,30 @@ public function forms() { return $this->hasMany(Form::class); } + + public function getOrCreateJWTAttribute() + { + $key = env('APP_KEY'); + $user = $this; + $user = array( + "uid" => $user->uid, + "email" => $user->email, + "name"=> $user->name + ); + + $app_id = (int) env('APP_ID'); + + $payload = array( + 'iss' => env('APP_NAME'), + 'aud' => 'practice.uffs.edu.br', + 'iat' => Carbon::now()->timestamp, + 'nbf' => Carbon::now()->timestamp - 1, + 'app_id' => $app_id, + 'user' => $user, + ); + + $jwt = JWT::encode($payload, $key, 'HS256'); + + return $jwt; + } } diff --git a/composer.json b/composer.json index fc6e2d9..8a0c29f 100644 --- a/composer.json +++ b/composer.json @@ -15,6 +15,7 @@ "composer/ca-bundle": "^1.2", "doctrine/dbal": "^3.0", "fideloper/proxy": "^4.2", + "firebase/php-jwt": "^6.3", "fruitcake/laravel-cors": "^2.0", "guzzlehttp/guzzle": "^7.2", "guzzlehttp/psr7": "1.7", diff --git a/composer.lock b/composer.lock index 185ee60..6289483 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "089a560eb4474944b9691bf72a3347c8", + "content-hash": "05fcc337c8f31872b773d38e97fd004e", "packages": [ { "name": "bacon/bacon-qr-code", @@ -1497,6 +1497,68 @@ }, "time": "2020-11-24T22:02:12+00:00" }, + { + "name": "firebase/php-jwt", + "version": "v6.3.0", + "source": { + "type": "git", + "url": "https://github.com/firebase/php-jwt.git", + "reference": "018dfc4e1da92ad8a1b90adc4893f476a3b41cb8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/018dfc4e1da92ad8a1b90adc4893f476a3b41cb8", + "reference": "018dfc4e1da92ad8a1b90adc4893f476a3b41cb8", + "shasum": "" + }, + "require": { + "php": "^7.1||^8.0" + }, + "require-dev": { + "guzzlehttp/guzzle": "^6.5||^7.4", + "phpspec/prophecy-phpunit": "^1.1", + "phpunit/phpunit": "^7.5||^9.5", + "psr/cache": "^1.0||^2.0", + "psr/http-client": "^1.0", + "psr/http-factory": "^1.0" + }, + "suggest": { + "paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present" + }, + "type": "library", + "autoload": { + "psr-4": { + "Firebase\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Neuman Vong", + "email": "neuman+pear@twilio.com", + "role": "Developer" + }, + { + "name": "Anant Narayanan", + "email": "anant@php.net", + "role": "Developer" + } + ], + "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", + "homepage": "https://github.com/firebase/php-jwt", + "keywords": [ + "jwt", + "php" + ], + "support": { + "issues": "https://github.com/firebase/php-jwt/issues", + "source": "https://github.com/firebase/php-jwt/tree/v6.3.0" + }, + "time": "2022-07-15T16:48:45+00:00" + }, { "name": "fruitcake/laravel-cors", "version": "v2.1.0", @@ -11720,5 +11782,5 @@ "php": "^7.3|^8.0" }, "platform-dev": [], - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.1.0" } diff --git a/public/css/theme.css b/public/css/theme.css index bdecafa..e4dac9c 100644 --- a/public/css/theme.css +++ b/public/css/theme.css @@ -8,6 +8,33 @@ /*-------------------------------------------------------------- # General --------------------------------------------------------------*/ +#aura_iframe{ + height:50%; + width:30%; + position: fixed; + bottom:80px; + right:40px; + border-radius: 10px + +} + +#aura_span { + position: fixed; + bottom: 30px; + right: 70px; + background-color: #c0d7e1; + padding: 3px; + border-radius: 20px; + cursor: pointer; +} + +@media(max-width: 700px){ + #aura_iframe{ + height:60%; + width:80%; + } +} + :root { scroll-behavior: smooth; } diff --git a/public/img/aura/aura_icon.png b/public/img/aura/aura_icon.png new file mode 100644 index 0000000..4d97f42 Binary files /dev/null and b/public/img/aura/aura_icon.png differ diff --git a/public/img/aura/aura_icon_online.png b/public/img/aura/aura_icon_online.png new file mode 100644 index 0000000..85804c1 Binary files /dev/null and b/public/img/aura/aura_icon_online.png differ diff --git a/public/img/aura/user.png b/public/img/aura/user.png new file mode 100644 index 0000000..d5db2f5 Binary files /dev/null and b/public/img/aura/user.png differ diff --git a/resources/views/layouts/base.blade.php b/resources/views/layouts/base.blade.php index 42e3113..1ff29e8 100644 --- a/resources/views/layouts/base.blade.php +++ b/resources/views/layouts/base.blade.php @@ -53,6 +53,30 @@ @include('layouts.footer') @endif + + + + + +