Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel: getting Sentinel authentication to do registration, login etc Easy questions

sort of installed Sentinel ( i say sort of because I dont understand one part that says:

Sentinel ships with default implementations for illuminate/database, in order to use it, make sure you require it on your composer.json file.

// Import the necessary classes

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

// Include the composer autoload file

require 'vendor/autoload.php';

Question 1: where do I write that code ?

Question 2:, what I care most now is how to make something out of this, regarding Registration, Activation etc. I would have expected to have a link created that is sent to your email and upon clicking on it you activate it. But all I can see it says is this:

$credentials = [
    'email'    => '[email protected]',
    'password' => 'password',
];

$user = Sentinel::register($credentials);

or if Also activate:

$credentials = [
    'email'    => '[email protected]',
    'password' => 'password',
];

$user = Sentinel::registerAndActivate($credentials);

I am supposed to write that in the Controller when I get the input ? and what about the email activation ?

like image 942
patricio Avatar asked Jul 31 '15 20:07

patricio


People also ask

Why we use Sentinel in Laravel?

Sentinel provides you all the tools you need to manage a role based authentication and authorization system.

How authentication works in Laravel?

Laravel includes built-in authentication and session services which are typically accessed via the Auth and Session facades. These features provide cookie-based authentication for requests that are initiated from web browsers. They provide methods that allow you to verify a user's credentials and authenticate the user.

What is Auth guard in Laravel?

At its core, Laravel's authentication facilities are made up of "guards" and "providers". Guards define how users are authenticated for each request. For example, Laravel ships with a session guard which maintains state using session storage and cookies.

What is Sentinel authentication?

By default, Sentinel uses single-factor authentication (SFA), which matches a password (“something that you know”) to a user name in the database. Sentinel Administrators can configure different types of strong and multi-factor techniques for all its users.


1 Answers

GETTING SENTINEL AUTHENTICATION-AUTHORIZATION PACKAGE REALLY RUNNING FOR TOTAL BEGINNERS:

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

It is the very author. If you had installed following any other site's instructions you had better removed your installation and run again composer update so that it gets rid off any traces of sentinel.

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

Once you do that, you will find there are already pre-created blade pages. You can go to Register as the first one, and enter your data (having configured your DB and Mail parameters before of course).

Also, at the Mail.php in the very latest version of Laravel, there is one parameter changed compared to former versions: the one about encryption. In my case I needed to set it as it was in the past, simply:

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

in the second case it won't be able to connect to your mail server.

This is saying, yes, that Sentinel already has that pre-built. Once you fill out the Registration Form, you will see yourself added to the Database but still not activated. Then in your mail box you will have that link I talked about. Click on it and your account will be activated.

like image 136
2 revs Avatar answered Sep 22 '22 11:09

2 revs