ipelatech/sephiri

A package that keeps users safe by ensuring that they have reset their passwords

1.0.0 2023-01-08 12:07 UTC

This package is not auto-updated.

Last update: 2024-04-29 16:11:52 UTC


README

Sephiri (pronounced something like "se-pee-ree") means "secret" in SeTswana.

Motivation

We often need to create users with default passwords for some clients. However, since we don't send passwords via email (and neither should you!), we came up with this pattern to check whether a user has changed their default password.

Requirements

This package was developed and tested using:

  • Laravel 9

  • PHP 8.1

Installation

You can install the package via composer:

composer require ipelatech/sephiri

Usage

After installing the package, add the `check_password` middleware to the route/route-group you want checking to happen. For example, as we use Laravel Breeze, we add it to the first route the user sees after logging in:

 Route::get('/dashboard', function () {
    return view('dashboard');
})->middleware(['auth', 'verified', "check_password"])->name('dashboard');

Blade Directive

The package also provides a blade directive, which you can use in your blade templates to alert a user to their password set status. Anywhere in your blade templates (we tend to use layouts/app.blade.php):

@password
  <section class="p-4 w-full bg-red-500">
     Your password is not set.
  </section>
@endpassword

Config

To publish the config file, you may run

php artisan vendor:publish --tag=sephiri-config

There is only one config option, `redirect_link`. Set this to the desired path. Again, for Breeze, we use:

return [
    "redirect_link" => "profile"
];

Which sends the user to their profile page to set their password.

Optional

Migration

To publish the migration, run:

php artisan vendor:publish --tag=sephiri-migration

Middleware

To publish the middleware, run:

php artisan vendor:publish --tag=sephiri-middleware

Testing

composer test

Security

If you discover any security related issues, please email opensource@ipelatech.co.za instead of using the issue tracker.

Credits

Licenses

MIT

The MIT License (MIT). Please see License File for more information.

HireWare

We at IpelaTech believe in providing simple tools that are easy to modify and extend. We also release our tools feature-complete, unless otherwise stated. We do not take all feature requests, especially if we believe they will unecessarily complicate or bloat the project. Feel free to request features, but keep in mind we value simplicity over a long feature list.

We also believe it's more sustainable to hire developers than to simply donate or ask for feature requests. As such, we encourage you to hire a developer (from this project or anywhere you outsource your development) to add functionality or modify the code when we or you cannot/will not. The thinking behind this is that you will be giving a developer, firstly, billable work, and secondly something for their portfolio and, thirdly, a client reference. We think it's a win-win situation for everyone.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.