Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I use custom users table (for example of other CMS)? #522

Open
ChefMC opened this issue Dec 20, 2019 · 2 comments
Open

Can I use custom users table (for example of other CMS)? #522

ChefMC opened this issue Dec 20, 2019 · 2 comments

Comments

@ChefMC
Copy link

ChefMC commented Dec 20, 2019

I have my own users database from one game. Can I use this existing users database table and authorize players on web-site via Sentinel as framework (for auth, sessions/cookie mechanism, remember me feature, XSS/CSRF protection)?

@rscarpim
Copy link

That's a wonderful question, also I would like if there's any chance to add more field's to the table user, and off-course control those fields?

@sabas
Copy link
Contributor

sabas commented Feb 2, 2020

You need to make your user tables compatible with the classes in src/Users I think, by replacing or extending them.

Adding other fields you can do, I extended EloquentUser, example:

class User extends \Cartalyst\Sentinel\Users\EloquentUser
{
    protected $fillable = [
        'email',
        'password',
        'last_name',
        'first_name',
        'permissions',
        'company',
        'department',
        'title',
        'phone',
        'mobile',
        'manager'
    ];

    protected $loginNames = ['email'];
}

Then I added the configuration (which is the same file from src/config/config.php with changes) before starting the instance

$config = new Cartalyst\Sentinel\Native\ConfigRepository(__DIR__.'/src/customSentinelConfig.php');
$bootstrapper = new Cartalyst\Sentinel\Native\SentinelBootstrapper($config);
Sentinel::instance($bootstrapper);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants