Passport OK

Passport OK with views
master
Paulo Vieira 2017-12-09 10:50:50 +00:00
parent d210552e89
commit 1292697242
52 changed files with 394 additions and 300 deletions

BIN
.DS_Store vendored

Binary file not shown.

BIN
laravel/.DS_Store vendored

Binary file not shown.

View File

@ -36,9 +36,4 @@ class LoginController extends Controller
{
$this->middleware('guest')->except('logout');
}
public function index()
{
return View('login');
}
}

View File

@ -68,9 +68,4 @@ class RegisterController extends Controller
'password' => bcrypt($data['password']),
]);
}
public function index()
{
return View('register');
}
}

View File

@ -1,28 +0,0 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class HomeController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('auth');
}
/**
* Show the application dashboard.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return view('home');
}
}

View File

@ -0,0 +1,43 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
define('YOUR_SERVER_URL', 'http://projeto.dev/');
define('CLIENT_ID', '2');
define('CLIENT_SECRET','kRWo05fZm5NC9zVRJlmd9IOwqUfQGJwf8QjuPWA3');
class LoginControllerAPI extends Controller
{
public function login(Request $request)
{
$http = new \GuzzleHttp\Client;
$response = $http->post(YOUR_SERVER_URL.'/oauth/token', [
'form_params' => [
'grant_type' => 'password',
'client_id' => CLIENT_ID,
'client_secret' => CLIENT_SECRET,
'username' => $request->email,
'password' => $request->password,
'scope' => ''], 'exceptions' => false,]);
$errorCode= $response->getStatusCode();
if ($errorCode=='200') {
return json_decode((string) $response->getBody(), true);
} else {
return response()->json(['msg'=>'User credentials are invalid'], $errorCode);
}
}
public function logout()
{
\Auth::guard('api')->user()->token()->revoke();
\Auth::guard('api')->user()->token()->delete();
return response()->json(['msg'=>'Token revoked'], 200);
}
}

View File

@ -14,7 +14,7 @@
"require-dev": {
"filp/whoops": "~2.0",
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"mockery/mockery": "~1.0",
"phpunit/phpunit": "~6.0"
},
"autoload": {

542
laravel/composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -42,7 +42,7 @@ return [
],
'api' => [
'driver' => 'passport',
'driver' => 'passport',
'provider' => 'users',
],
],

View File

@ -86,6 +86,9 @@ return [
|
*/
'prefix' => 'laravel',
'prefix' => env(
'CACHE_PREFIX',
str_slug(env('APP_NAME', 'laravel'), '_').'_cache'
),
];

View File

@ -57,9 +57,9 @@ return [
's3' => [
'driver' => 's3',
'key' => env('AWS_KEY'),
'secret' => env('AWS_SECRET'),
'region' => env('AWS_REGION'),
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
],

View File

@ -29,7 +29,7 @@ return [
|
*/
'lifetime' => 120,
'lifetime' => env('SESSION_LIFETIME', 120),
'expire_on_close' => false,

View File

@ -11,6 +11,6 @@ class DatabaseSeeder extends Seeder
*/
public function run()
{
$this->call(UsersTableSeeder::class);
$this->call(UsersTableSeeder::class);
}
}

View File

@ -7,15 +7,15 @@
"watch-poll": "npm run watch -- --watch-poll",
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
"axios": "^0.16.2",
"axios": "^0.17",
"bootstrap-sass": "^3.3.7",
"cross-env": "^5.0.1",
"jquery": "^3.1.1",
"cross-env": "^5.1",
"jquery": "^3.2",
"laravel-mix": "^1.0",
"lodash": "^4.17.4",
"vue": "^2.1.10"
"vue": "^2.5.7"
}
}

0
laravel/public/.DS_Store vendored Normal file → Executable file
View File

0
laravel/public/.htaccess Normal file → Executable file
View File

0
laravel/public/css/app.css vendored Normal file → Executable file
View File

0
laravel/public/css/style.css vendored Normal file → Executable file
View File

0
laravel/public/favicon.ico Normal file → Executable file
View File

View File

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 106 KiB

0
laravel/public/img/background.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

0
laravel/public/img/icon.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 691 B

After

Width:  |  Height:  |  Size: 691 B

0
laravel/public/index.php Normal file → Executable file
View File

0
laravel/public/js/app.js vendored Normal file → Executable file
View File

0
laravel/public/mix-manifest.json Normal file → Executable file
View File

0
laravel/public/robots.txt Normal file → Executable file
View File

0
laravel/public/web.config Normal file → Executable file
View File

View File

@ -19,26 +19,31 @@ Laravel is a web application framework with expressive, elegant syntax. We belie
- [Robust background job processing](https://laravel.com/docs/queues).
- [Real-time event broadcasting](https://laravel.com/docs/broadcasting).
Laravel is accessible, yet powerful, providing tools needed for large, robust applications. A superb combination of simplicity, elegance, and innovation give you tools you need to build any application with which you are tasked.
Laravel is accessible, yet powerful, providing tools needed for large, robust applications.
## Learning Laravel
Laravel has the most extensive and thorough documentation and video tutorial library of any modern web application framework. The [Laravel documentation](https://laravel.com/docs) is thorough, complete, and makes it a breeze to get started learning the framework.
Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of any modern web application framework, making it a breeze to get started learning the framework.
If you're not in the mood to read, [Laracasts](https://laracasts.com) contains over 900 video tutorials on a range of topics including Laravel, modern PHP, unit testing, JavaScript, and more. Boost the skill level of yourself and your entire team by digging into our comprehensive video library.
If you're not in the mood to read, [Laracasts](https://laracasts.com) contains over 1100 video tutorials on a range of topics including Laravel, modern PHP, unit testing, JavaScript, and more. Boost the skill level of yourself and your entire team by digging into our comprehensive video library.
## Laravel Sponsors
We would like to extend our thanks to the following sponsors for helping fund on-going Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](http://patreon.com/taylorotwell):
- **[Vehikl](http://vehikl.com)**
- **[Vehikl](https://vehikl.com/)**
- **[Tighten Co.](https://tighten.co)**
- **[British Software Development](https://www.britishsoftware.co)**
- **[Styde](https://styde.net)**
- [Fragrantica](https://www.fragrantica.com)
- [SOFTonSOFA](https://softonsofa.com/)
- [User10](https://user10.com)
- [Soumettre.fr](https://soumettre.fr/)
- [CodeBrisk](https://codebrisk.com)
- [1Forge](https://1forge.com)
- [TECPRESSO](https://tecpresso.co.jp/)
- [Pulse Storm](http://www.pulsestorm.net/)
- [Runtime Converter](http://runtimeconverter.com/)
- [WebL'Agence](https://weblagence.com/)
## Contributing
@ -46,7 +51,7 @@ Thank you for considering contributing to the Laravel framework! The contributio
## Security Vulnerabilities
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell at taylor@laravel.com. All security vulnerabilities will be promptly addressed.
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed.
## License

0
laravel/resources/assets/js/app.js vendored Normal file → Executable file
View File

0
laravel/resources/assets/js/bootstrap.js vendored Normal file → Executable file
View File

0
laravel/resources/assets/js/components/Example.vue Normal file → Executable file
View File

0
laravel/resources/assets/sass/_variables.scss vendored Normal file → Executable file
View File

0
laravel/resources/assets/sass/app.scss vendored Normal file → Executable file
View File

0
laravel/resources/lang/en/auth.php Normal file → Executable file
View File

0
laravel/resources/lang/en/pagination.php Normal file → Executable file
View File

0
laravel/resources/lang/en/passwords.php Normal file → Executable file
View File

0
laravel/resources/lang/en/validation.php Normal file → Executable file
View File

0
laravel/resources/views/auth/login.blade.php Normal file → Executable file
View File

0
laravel/resources/views/auth/passwords/email.blade.php Normal file → Executable file
View File

0
laravel/resources/views/auth/passwords/reset.blade.php Normal file → Executable file
View File

0
laravel/resources/views/auth/register.blade.php Normal file → Executable file
View File

0
laravel/resources/views/footer.blade.php Normal file → Executable file
View File

4
laravel/resources/views/header.blade.php Normal file → Executable file
View File

@ -18,8 +18,8 @@
<a class="navbar-brand" href="#">BadMemoryGame</a>
<form class="form-inline my-2 my-lg-0">
<li>
<button class="btn btn-outline-success" type="submit" href="{{route('login')}}">Login</button>
<button class="btn btn-outline-success" type="submit" href="{{route('register')}}">Registar</button>
<button class="btn btn-outline-success" type="submit">Login</button>
<button class="btn btn-outline-success" type="submit">Registar</button>
</li>
</form>
</nav>

0
laravel/resources/views/home.blade.php Normal file → Executable file
View File

0
laravel/resources/views/layouts/app.blade.php Normal file → Executable file
View File

0
laravel/resources/views/welcome.blade.php Normal file → Executable file
View File

View File

@ -16,3 +16,14 @@ use Illuminate\Http\Request;
Route::middleware('auth:api')->get('/user', function (Request $request) {
return $request->user();
});
Route::post('login', 'LoginControllerAPI@login');
Route::middleware('auth:api')->post('logout', 'LoginControllerAPI@logout');
Route::get('teste', function () {
return response()->json(['msg'=>'Só um teste'], 200);
});
Route::middleware('auth:api')->get('teste', function () {
return response()->json(['msg'=>'Só um teste'], 200);
});

View File

@ -14,13 +14,3 @@
Route::get('/', function () {
return view('welcome');
});
Route::get('/login', 'Auth\LoginController@index');
Route::post('/login', 'Auth\LoginController@login')->name('login');
Route::get('/register', 'Auth\RegisterController@index');
Route::post('/register', 'Auth\RegisterController@register')->name('register');
Auth::routes();
Route::get('/home', 'HomeController@index')->name('home');