Laravel nova - login only for active user - disable login for inactive user - laravel-nova

using Laravel Nova, I want to disable inactive user from login,
and logout the user if already logged in,
i"m having a boolean column: "active" in users table.
if possible to show a message "only active users allowed to login" to inactive user
in the answer please specify exactly which file to edit and its path

Related

Select tenant after login preventing user to use the system before that

I want to something like:
After user logged in open a view to select the Tenant that user will use to work. But I want to prevent user to access the system without set the Tenant.
Details:
I need the tenant selection to be in a second page different of the login page, because I want to show only the Tenants that have relashionship with this user.

Using Devise, can I allow inactive users to still login but only to a landing page?

As I understand it, using Devise, inactive users are not allowed to login, instead will see an inactive user message on the login page. Can I change this behavior so that user is allowed to login, but only see a landing page?
You could simply do this with a global before_action in your ApplicationController, redirecting logged in but inactive users to your landing page.

Is Devise gem support for single user login?

A user named 'user1' signed in at compter a. Then in another computer b, account 'user1' can't sign in, user1 must logout, then user1 can sign in on computer b.
Is devise support for this?
You can add column into users table, which will indicate if user logged in or no. Set it to true when user logs in, and then false when logs out. On user login check this column if its false, then login your user, otherwise show some notification than somebody else using this account.
To avoid situation when user just closes tab without logging off, make rake task that will logout user after some time
UPD: As #Arjan said, you dont even need rake task, you can use devise's module for this

Devise and user registration requiring admin approval

I would like to implement the following registration system :
User signs up and is redirected
to a thank you for signing up page
(is NOT sent an email and cannot yet log in)
Admin logs in and sees list of newly registered (but as yet unapproved) users
Admin edits user details and clicks 'Approved' which then sends email with password to new user
How can I do this with Devise?
This is answered in a page on the Devise wiki.

In a rail application i want to authorize admin to create a new record in particular module.not any user

Requirement:
I have a deal module in my rail application. when the user click on create new deal link it will check chat whether the user is admin or not.if the user is admin i want to allow
it to create a new deal otherwise it will display a flash message that you are not allowed and redirect the user to signin page to login as admin.if the user sign in as admin i want to redirect it to a page from where it previously comes.
Devise and cancan should help

Resources