Skip to content

Commit

Permalink
Merge pull request #14 from codebar-ag/feature-updates
Browse files Browse the repository at this point in the history
Feature updates
  • Loading branch information
RhysLees committed Sep 18, 2023
2 parents 9f68300 + 14087ae commit 96003bc
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 57 deletions.
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,12 @@ return [
| Logo Settings
|--------------------------------------------------------------------------
| You may like to define a different logo for the login page.
| The path is relative to the public folder.
| You can pass either a path relative to the public folder or a full url.
|
*/
'logo' => [
'path' => 'vendor/auth/images/lock.svg',
// 'path' => 'https://example.test/images/logo.png',
],

/*
Expand Down Expand Up @@ -281,7 +282,21 @@ return [
'disabled' => [
// ProviderEnum::MICROSOFT_OFFICE_365(),
],
]
],


/*
|--------------------------------------------------------------------------
| Feature Settings
|--------------------------------------------------------------------------
| By default, all features are enabled.
| You may disable a provider by adding changing the value to false.
|
*/
'features' => [
'password_reset' => true,
'email_verification' => true,
],
];
```

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"laravel/socialite": "^5.8",
"socialiteproviders/microsoft": "^4.2",
"spatie/laravel-enum": "^3.0",
"spatie/laravel-package-tools": "^1.14.0",
"spatie/laravel-package-tools": "^1.16.1",
"spatie/laravel-flash": "^1.9",
"spatie/laravel-activitylog": "^4.7",
"spatie/laravel-honeypot": "^4.3"
Expand Down
13 changes: 13 additions & 0 deletions config/laravel-auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,4 +93,17 @@
ProviderEnum::MICROSOFT_OFFICE_365(),
],
],

/*
|--------------------------------------------------------------------------
| Feature Settings
|--------------------------------------------------------------------------
| By default, all features are enabled.
| You may disable a provider by adding changing the value to false.
|
*/
'features' => [
'password_reset' => true,
'email_verification' => true,
],
];
2 changes: 1 addition & 1 deletion resources/dist/authcss.css

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion resources/views/components/logo.blade.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@if(config('laravel-auth.logo.path'))
@if(config('laravel-auth.logo.path') && !filter_var(config('laravel-auth.logo.path'), FILTER_VALIDATE_URL))
<img src="{{ asset(config('laravel-auth.logo.path')) }}" alt="{{__('auth::translations.logo')}}" {{ $attributes->merge(['class' => 'mx-auto w-[25%]']) }}>
@else
<img src="{{ config('laravel-auth.logo.path') }}" alt="{{__('auth::translations.logo')}}" {{ $attributes->merge(['class' => 'mx-auto w-[25%]']) }}>
@endif
12 changes: 7 additions & 5 deletions resources/views/login.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@
:label="__('auth::translations.remember-me')"
/>

<div class="flex items-center">
<a href="{{ route('auth.request-password') }}"
class="block text-sm text-gray-900 hover:text-gray-500 underline">{{ __('auth::translations.forgot-password') }}</a>
</div>
@if(config('laravel-auth.features.password_reset'))
<div class="flex items-center">
<a href="{{ route('auth.request-password') }}"
class="block text-sm text-gray-900 hover:text-gray-500 underline">{{ __('auth::translations.forgot-password') }}</a>
</div>
@endif
</div>

<div class="space-y-4">
Expand All @@ -45,7 +47,7 @@ class="block text-sm text-gray-900 hover:text-gray-500 underline">{{ __('auth::t
@if(! in_array(\CodebarAg\LaravelAuth\Enums\ProviderEnum::MICROSOFT_OFFICE_365(), config('laravel-auth.providers.disabled')))
<x-auth::form.button.ahref
:href="route('auth.provider', \CodebarAg\LaravelAuth\Enums\ProviderEnum::MICROSOFT_OFFICE_365())"
class="bg-gray-500"
class="bg-gray-500 hover:bg-gray-400"
>
<svg class="fill-white w-4 h-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 278050 333334" shape-rendering="geometricPrecision" text-rendering="geometricPrecision" image-rendering="optimizeQuality" fill-rule="evenodd" clip-rule="evenodd"><path fill="currentColor" d="M278050 305556l-29-16V28627L178807 0 448 66971l-448 87 22 200227 60865-23821V80555l117920-28193-17 239519L122 267285l178668 65976v73l99231-27462v-316z"/></svg>
<span>{{ __('auth::translations.sign-in-with-microsoft') }}</span>
Expand Down
46 changes: 25 additions & 21 deletions routes/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,24 @@
->name('login.store');
});

Route::prefix('password')->group(function () {
Route::get('/')->uses([RequestPasswordController::class, 'index'])
->name('request-password');
if (config('laravel-auth.features.password_reset')) {
Route::prefix('password')->group(function () {
Route::get('/')->uses([RequestPasswordController::class, 'index'])
->name('request-password');

Route::post('store')->uses([RequestPasswordController::class, 'store'])
->name('request-password.store')
->middleware(ProtectAgainstSpam::class);
Route::post('store')->uses([RequestPasswordController::class, 'store'])
->name('request-password.store')
->middleware(ProtectAgainstSpam::class);

Route::get('token/{token}')->uses([ResetPasswordController::class, 'index'])
->name('reset-password')
->middleware('signed');
Route::get('token/{token}')->uses([ResetPasswordController::class, 'index'])
->name('reset-password')
->middleware('signed');

Route::post('reset')->uses([ResetPasswordController::class, 'store'])
->name('reset-password.store')
->middleware(ProtectAgainstSpam::class);
});
Route::post('reset')->uses([ResetPasswordController::class, 'store'])
->name('reset-password.store')
->middleware(ProtectAgainstSpam::class);
});
}

Route::prefix('service')->group(function () {
Route::get('{service}', [ProviderController::class, 'service'])->name('provider');
Expand All @@ -47,15 +49,17 @@
Route::any('logout')->uses(LogoutController::class)
->name('logout');

Route::prefix('email')->group(function () {
Route::get('verify')->uses([EmailVerificationController::class, 'index'])
->name('verification.notice');
if (config('laravel-auth.features.email_verification')) {
Route::prefix('email')->group(function () {
Route::get('verify')->uses([EmailVerificationController::class, 'index'])
->name('verification.notice');

Route::get('verify/{id}/{hash}')->uses([EmailVerificationController::class, 'store'])
->middleware(['signed'])->name('verification.verify');
Route::get('verify/{id}/{hash}')->uses([EmailVerificationController::class, 'store'])
->middleware(['signed'])->name('verification.verify');

Route::post('verification-notification')->uses([EmailVerificationController::class, 'send'])
->name('verification.send');
});
Route::post('verification-notification')->uses([EmailVerificationController::class, 'send'])
->name('verification.send');
});
}
});
});
26 changes: 0 additions & 26 deletions tests/Feature/LoginControllerTest.php

This file was deleted.

0 comments on commit 96003bc

Please sign in to comment.