Git Product home page Git Product logo

centaur's Introduction

Centaur

Tests Packagist Packagist Packagist

This package provides an opinionated implementation of Cartalyst Sentinel for Laravel.

If you are using an older version of Laravel, there are other versions available.

Installation

Install the Package Via Composer:

$ composer require srlabs/centaur

Add the Service Provider to your config/app.php file:

'providers' => array(
    ...
    Centaur\CentaurServiceProvider::class,
    ...
)

This package will not make use of automatic package discovery - you will need to register it manually. This is intentional.

Usage in New Applications

If you are starting a new Laravel 5.* application, this package provides a convenient way to get up and running with Cartalyst\Sentinel very quickly. Start by removing the default auth scaffolding that ships with a new Laravel 5.1 application:

$ php artisan centaur:spruce

Next, use Centaur's scaffolding command to create basic Auth Controllers and Views in your application:

$ php artisan centaur:scaffold

Publish the Cartalyst\Sentinel assets:

$ php artisan vendor:publish --provider="Cartalyst\Sentinel\Laravel\SentinelServiceProvider"

Run your database migrations:

$ php artisan migrate

Run the Database Seeder. You may need to re-generate the autoloader before this will work:

$ composer dump-autoload
$ php artisan db:seed --class="SentinelDatabaseSeeder"

You will also need to add these routes to your routes.php file:

// Authorization
Route::get('login', 'Auth\SessionController@getLogin')->name('auth.login.form');
Route::post('login', 'Auth\SessionController@postLogin')->name('auth.login.attempt');
Route::any('logout', 'Auth\SessionController@getLogout')->name('auth.logout');

// Registration
Route::get('register', 'Auth\RegistrationController@getRegister')->name('auth.register.form');
Route::post('register', 'Auth\RegistrationController@postRegister')->name('auth.register.attempt');

// Activation
Route::get('activate/{code}', 'Auth\RegistrationController@getActivate')->name('auth.activation.attempt');
Route::get('resend', 'Auth\RegistrationController@getResend')->name('auth.activation.request');
Route::post('resend', 'Auth\RegistrationController@postResend')->name('auth.activation.resend');

// Password Reset
Route::get('password/reset/{code}', 'Auth\PasswordController@getReset')->name('auth.password.reset.form');
Route::post('password/reset/{code}', 'Auth\PasswordController@postReset')->name('auth.password.reset.attempt');
Route::get('password/reset', 'Auth\PasswordController@getRequest')->name('auth.password.request.form');
Route::post('password/reset', 'Auth\PasswordController@postRequest')->name('auth.password.request.attempt');

// Users
Route::resource('users', 'UserController');

// Roles
Route::resource('roles', 'RoleController');

// Dashboard
Route::get('dashboard', function () {
    return view('Centaur::dashboard');
})->name('dashboard');

This is only meant to be a starting point; you can change them as you see fit. Make sure you read through your new Auth Controllers and understand how they work before you make any changes.

Centaur automatically installs Sentinel and registers the Sentinel, Activations, and Reminders aliases for you. Detailed instructions for using Sentinel can be found here.

If you do decide to make use of Laravel's Route::resource() option, you will need to use Form Method Spoofing to access some of those generated routes.

Usage in Existing Applications

If you already have already built out your auth views and controllers, the best way to make use of this package is to inject the AuthManager into your controllers and use it as a wrapper for Sentinel. Detailed information about the AuthManager methods can be found here.

Using Customized Middleware

It is possible that the behavior of the Middleware that comes with this package might not suit your exact needs. To adjust the middleware, create a copy of the problematic Centaur Middleware class in your app/Http/Middleware directory - this new class can be given any name you would like. You can then adjust the middleware references in your controllers and/or routes file to use the new class, or you can bind the new class to the Centaur Middleware class name in your App service provider, as such:

// app/providers/AppServiceProvider.php
/**
 * Register any application services.
 *
 * @return void
 */
public function register()
{
    $this->app->bind('Centaur\Middleware\SentinelGuest', function ($app) {
        return new \App\Http\Middleware\AlternativeGuestMiddleware;
    });
}

centaur's People

Contributors

brunowerneck avatar cgrice avatar fabiofdsantos avatar jigneshsolanki avatar laravel-shift avatar pierlon avatar prenna avatar rorichster avatar rydurham avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

centaur's Issues

Translate your package

Hello,

I use your package and try to translate it (french).
Middlewares are not translated
AuthManager.php has this : $this->translate('user_logout', 'You have been logged out')

How can I do ?

Thanks

Loop after role deletion

We should prevent role ID 1 from being removed but I'm not sure if the problem affects only this ID.

The role is being deleted successfully, then the browser enters in a loop of requests.

imagem

Potential front-end solution:
Add {{ $role->id === 1 ? 'disabled' : '' }} to the delete button.

Expected response code 250 but got code "530", with message "530 5.7.1 Authentication required"

I have this issue:

Expected response code 250 but got code "530", with message "530 5.7.1 Authentication required"

this occurred when I follow the basic in the markdown and successfully migrate the database and post a registration form at '/register'.

I use :

  • Laravel 5.4.26
  • "srlabs/centaur": "4.*" (4.0.3)
  • cartalyst/support (v2.0.1) (generated from centaur)
  • cartalyst/sentinel (v2.0.15) (generated from centaur)

Dear Centaur can you please let me know when php 8.0 support will be available?

Dear Centaur can you please let me know when php 8.0 support will be available?

Your requirements could not be resolved to an installable set of packages.

Problem 1
- srlabs/centaur 10.00.01 requires php ^7.2 -> your PHP version (8.0.0) does not satisfy that requirement.
- srlabs/centaur 10.0.0 requires php ^7.2 -> your PHP version (8.0.0) does not satisfy that requirement.
- srlabs/centaur 10.00.01 requires php ^7.2 -> your PHP version (8.0.0) does not satisfy that requirement.
- Installation request for srlabs/centaur ^10.0 -> satisfiable by srlabs/centaur[10.0.0, 10.00.01].

Laravel 5.7 release

Hey,
There doesn't seem to be a tag for laravel 5.7 (ie release tagged 7.x.x)
Are you able to create one as there seems the 5.7 support?
Thanks!

Error messages not showing up

I've created a new installation using Laravel 5.2 and srlabs/centaur ^2.0, followed all instructions using artisan commands. Everything work fine but error messages simply won't show. I tried generating error messages by simulating erroneous user input at login, registration and by trying to delete admin account but the system only refreshes the page but won't show any errors.

Need help at upgrading from rydurham/Sentinel

Hi there,

this is not an issue report. I just need some help.

I got an project that was built with laravel 4 and rydurham/Sentinel.
Since Laravel 4 is not very recent anymore it should be updated to the newest possible version.

After reading some warning to not use rydurham/sentinel i decided to use the solution linked from there (this one).

I followed the instructions and it seems to work so far. Not exceptions, the login page works fine.

But there is one thing that breaks it for me. I believe it is a small thing, but i need further information about how it should be.

There is the line: php artisan db:seed --class="SentinelDatabaseSeeder" that should be executed.
But i can't use this, since i have already an user table from the current setup.

Trying to login results in a exception that tells me that there is a column ("type") missing.

So the current user table with the columns (id ,email ,password ,permissions ,activated ,activation_code ,activated_at ,last_login ,persist_code ,reset_password_code ,first_name ,last_name ,company ,master ,global ,created_at ,updated_at) is not compatible to centaur/sentinel.

I also saw that there is a migration script from sentinel. I could let the script recreate all tables (they were empty) except the users table.

So here is my question.
Can i migrate the users table to be compatible with centaur/sentinel?
Or should i better go back to rydurham/sentinel?
Is there a documentation about the users table content? (in order to remap the data)

I am grateful for every help ๐Ÿ‘

Account Not Yet Activated Debug page Change

Hi,

In Centaur, If a Registered user tries to Login before activating himself via email, it's expected that an error message will show as a notification that "Your account has not been activated yet."

Instead of the error message to show as notification, it's showing as a Debug page Application frames.

Please kindly advise me on the steps to take to make the error message show up as Notification rather than Debug page.

Thanks

Activation route redirects to error page

Hi,

Authentication and Authorization works fine until i clicked the Activation link sent to new user email.

On clinking the Activation email line, the page that displayed showed this error

InvalidArgumentException
Route [login] not defined.

I actually want to activation link to redirect to {{route('auth.login.form')}} but kept redirecting to the error page.

I have tried all solutions but none seems not to work

Please kindly advise on what i should do. Thanks

Using custom User Model

I am facing a problem, i want to use my User model instead of EloquentUser Model, because i want to add more fields, i have already updated the cartalyst.sentinel.php config file

'users' => [

    // 'model' => 'Cartalyst\Sentinel\Users\EloquentUser',
    'model' => 'App\User',

],

And in the User.php model is added
use Cartalyst\Sentinel\Users\EloquentUser as SentinelUser;
class User extends SentinelUser
{
}

But still it is using the EloquentUser model.

Laravel Passport

Hello,

I'm trying to build API's for a project. However, I'm confused as to how to make this work with L5.3 Passport. I know this issues sounds vague. But a little light towards the right direction might help.

Regards

How can i use correctly remember me

Im trying to use this feature but i just cant know how to implement it since there is no documentation about this.

i know i need to set remember me as true when i authenticate but then what i need to do for the user not need to write his username and/or password again to login.

could someone help me? please

Delete user and roles is not possible

Hi,

I'm using your fantastic package but I have a weird issue.
I could delete user and roles easily but now it's not working anymore. I'm redirected directly on the controller's index view

I do not change middleware or other.

What do you think ?

Thanks for your time,

Regards

Allowing users to edit only their own articles

Hi,
I'd like to implement the following access rules for an app where users can post articles, I would like to have an "admin" role and a "user" role, and set up the permissions so that users can create articles, users can edit only the articles that they created, and admins can edit all articles.
In this case, the "admin" role would have an "articles.edit" permission, but I'm not sure how to handle the "user" role.
Does this package provide an out-of-the-box solution for this case?
Thank you in advance.

Social login

Is there any way I can use this package to login a user with facebook?

I've already made the logic to get the user details from facebook, but I got stuck at login part. I don't know how to make the login using this package.

any suggestions?

Throttle

How to use throttle from route login attempts and configuration. Thanks.

Login page redirecting to Dasboard

I have two login page one /admin/login other direct /login and when i hit the /admin/login its redirecting me to /dasboard directly when i'm already logged in
But its should redirect me to admin/dasboard i couldnt find how can i change this why its redirecting me to dashboard

Laravel 8 and Cartalyst 5 support.

It may just need version numbers bumping in composer.json, but with Centaur 10.00.01 I can't upgrade to Laravel 8.

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for srlabs/centaur ^10.0 -> satisfiable by srlabs/centaur[10.0.0, 10.00.01].
    - Can only install one of: cartalyst/sentinel[5.x-dev, 4.x-dev].
    - Can only install one of: cartalyst/sentinel[5.0.x-dev, 4.x-dev].
    - Can only install one of: cartalyst/sentinel[v5.0.0, 4.x-dev].
    - Conclusion: install cartalyst/sentinel 4.x-dev
    - Installation request for cartalyst/sentinel ^5.0 -> satisfiable by cartalyst/sentinel[5.x-dev, 5.0.x-dev, v5.0.0].

Only mailables may be queued. InvalidArgumentException in Mailer.php line 314:

Error when registering new user (guess it will be the same for any action that sends an email) because Laravel 5.3/5.4 use mailables.

  1. in Mailer.php line 314
  2. at Mailer->queue('centaur.email.welcome', array('code' => 'randomstring', 'email' => '[email protected]'), object(Closure)) in Facade.php line 221
  3. at Facade::__callStatic('queue', array('centaur.email.welcome', array('code' => 'randomstring', 'email' => '[email protected]'), object(Closure))) in UserController.php line 99
  4. at Mail::queue('centaur.email.welcome', array('code' => 'randomstring', 'email' => '[email protected]'), object(Closure)) in UserController.php line 99
  5. at UserController->store(object(Request))
    ...

I'm relatively new to development so don't know how to go about fixing this myself.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.