Laravel: getting Sentinel authentication for registration, login, etc. Easy questions

the kind of installed sentinel (I say because I do not understand the one part that says:

Sentinel sends with the default implementation for the backlight / database to use it, make sure you require it in the composer.json file.

// Import the necessary classes

use Cartalyst\Sentinel\Native\Facades\Sentinel; use Illuminate\Database\Capsule\Manager as Capsule; 

// Include composer startup file

 require 'vendor/autoload.php'; 

Question 1: where do I write this code?

Question 2: now I’m most interested in how to make one of this regarding registration, activation, etc. I would expect that a link will be created that will be sent to your email address, and after clicking on it you will activate it, But all I see is that it says the following:

 $credentials = [ 'email' => ' john.doe@example.com ', 'password' => 'password', ]; $user = Sentinel::register($credentials); or if Also activate: $credentials = [ 'email' => ' john.doe@example.com ', 'password' => 'password', ]; $user = Sentinel::registerAndActivate($credentials); 

I have to write, what is in the controller when I get the input? and how about activating email?

+6
source share
4 answers

The following code:

use Cartalyst\Sentinel\Native\Facades\Sentinel; use Illuminate\Database\Capsule\Manager as Capsule;

Is for people trying to use the package natively. Since you are using laravel, you do not need this. Please make sure you follow the instructions for laravel.

Since you noted laravel-5 in your question, I assume this is what you are using. In this case, first add this to your composer.json: composer require cartalyst/sentinel "2.0.*" And the following to the config / app.php file:

To the $providers array: 'Cartalyst\Sentinel\Laravel\SentinelServiceProvider',

And to $alias~ array :

'Activation' => 'Cartalyst\Sentinel\Laravel\Facades\Activation', 'Reminder' => 'Cartalyst\Sentinel\Laravel\Facades\Reminder', 'Sentinel' => 'Cartalyst\Sentinel\Laravel\Facades\Sentinel',

Once you do this, you can publish and transfer the package. You also need to extend Cartalyst\Sentinel\Users\EloquentUser to a user model instead of Eloquent. You will need to do the same if you are using a role model.

For more information, follow the documentation: https://cartalyst.com/manual/sentinel/2.0#laravel-5

make sure you are on the correct version: 2.0 for Laravel 5 and 1.0 for laravel 4. *

Regarding your second question, you will need to send an email to the client with the activation code (usually the code is hidden as a query string or something else, so the user does not need to know from this), and how do you activate the code. Or, if you prefer, you can automatically authenticate after registration.

More about activation in your documentation if you still cannot understand that we are here to help, but try for yourself first.

+4
source

OBTAINING SENTINEL AUTHORIZATION AUTHORIZATION PACKAGE REALLY WORKS FOR ALL PRINTERS:

https://github.com/rydurham/Sentinel/blob/master/readme.md

This is the author himself. If you have installed any other instructions on the site, you better remove your installation and run the composer update again to get rid of any sentinel traces.

Install the following steps of ryan durham. (they are at least valid at the date of publication).

Once you do this, you will find that pre-created blades are already created. You can go to the Register as the first and enter your data (after setting up the database and mail parameters).

In addition, in Mail.php, the most recent version of Laravel has one parameter that has been changed from previous versions: one about encryption. In my case, I needed to install it as it was in the past, simply:

'encryption' => 'ssl' and NOT AS 'encryption' => env ('MAIL_ENCRYPTION', $ _ENV ['MAIL_ENCRYPTION']

in the second case, he will not be able to connect to your mail server.

That says yes, Sentinel already has a built-in. After filling out the registration form, you will see that you have added to the database, but are still not activated. Then in your inbox you will have this link of which I spoke. Click on it and your account will be activated.

+4
source

Take a look at this package:
https://github.com/srlabs/centaur
this will help you get up and work with cartalyst/sentinel

+3
source

I know this post is old, but similar to srlabs / centaur, you can use Sentinel Centurion .

This allows you to quickly authenticate, register, allow / manage roles / users, forget the password, activation emails, etc. Using Cartalyst Sentinel.

0
source

All Articles