Skip to content

Commit

Permalink
WIP implement login and register button
Browse files Browse the repository at this point in the history
  • Loading branch information
mzur committed Apr 6, 2023
1 parent 860997a commit 65eac6e
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 27 deletions.
31 changes: 31 additions & 0 deletions src/Http/Controllers/LSLoginController.php
@@ -0,0 +1,31 @@
<?php

namespace Biigle\Modules\AuthLSLogin\Http\Controllers;

use Biigle\Http\Controllers\Controller;
use Laravel\Socialite\Facades\Socialite;

class LSLoginController extends Controller
{
/**
* Redirect to the authentication provider
*
* @return mixed
*/
public function redirect()
{
return Socialite::driver('lifesciencelogin')->redirect();
}

/**
* Handle the authentication response
*
* @return mixed
*/
public function callback()
{
$user = Socialite::driver('lifesciencelogin')->user();

//...
}
}
17 changes: 8 additions & 9 deletions src/Http/routes.php
@@ -1,12 +1,11 @@
<?php

// $router->get('quotes', [
// 'middleware' => 'auth',
// 'as' => 'quotes',
// 'uses' => 'QuotesController@index',
// ]);
$router->get('auth/lslogin/redirect', [
'as' => 'lslogin-redirect',
'uses' => 'LSLoginController@redirect',
]);

// $router->get('quotes/new', [
// 'middleware' => 'auth',
// 'uses' => 'QuotesController@quote',
// ]);
$router->get('auth/lslogin/callback', [
'as' => 'lslogin-callback',
'uses' => 'LSLoginController@callback',
]);
37 changes: 19 additions & 18 deletions src/LSLoginServiceProvider.php
Expand Up @@ -18,24 +18,25 @@ class LSLoginServiceProvider extends ServiceProvider
*/
public function boot(Modules $modules, Router $router)
{
// $this->loadViewsFrom(__DIR__.'/resources/views', 'auth-lslogin');

// $router->group([
// 'namespace' => 'Biigle\Modules\Module\Http\Controllers',
// 'middleware' => 'web',
// ], function ($router) {
// require __DIR__.'/Http/routes.php';
// });

// $modules->register('module', [
// 'viewMixins' => [
// 'dashboardMain',
// ],
// ]);

// $this->publishes([
// __DIR__.'/public/assets' => public_path('vendor/auth-lslogin'),
// ], 'public');
$this->loadViewsFrom(__DIR__.'/resources/views', 'auth-lslogin');

$router->group([
'namespace' => 'Biigle\Modules\AuthLSLogin\Http\Controllers',
'middleware' => 'web',
], function ($router) {
require __DIR__.'/Http/routes.php';
});

$modules->register('auth-lslogin', [
'viewMixins' => [
'loginButton',
'registerButton',
],
]);

$this->publishes([
__DIR__.'/public/assets' => public_path('vendor/auth-lslogin'),
], 'public');
}

/**
Expand Down
Binary file added src/public/assets/login-grey-wide.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/resources/views/loginButton.blade.php
@@ -0,0 +1,3 @@
<a style="display: block; text-align: center;" href="{{ route('lslogin-redirect') }}" title="Log in via Life Science Login">
<img style="height: 34px" src="{{ cachebust_asset('vendor/auth-lslogin/login-grey-wide.png') }}">
</a>
3 changes: 3 additions & 0 deletions src/resources/views/registerButton.blade.php
@@ -0,0 +1,3 @@
<a style="display: block; text-align: center;" href="{{ route('lslogin-redirect') }}" title="Sign up via Life Science Login">
<img style="height: 34px" src="{{ cachebust_asset('vendor/auth-lslogin/login-grey-wide.png') }}">
</a>

0 comments on commit 65eac6e

Please sign in to comment.