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

Add admin invitiations to project #637

Draft
wants to merge 1 commit into
base: add-admin-crud-ui
Choose a base branch
from

Conversation

murny
Copy link
Collaborator

@murny murny commented Aug 30, 2024

This PR adds https://github.com/scambra/devise_invitable gem and the ability to invite admin users.

Instead of a New User button, it is now an Invite New Admin button:

image

Clicking this button takes you to a screen to create a new admin invitation:
image

Filling out the email address and hitting send will send this email address an Email address to invite them to the site. They will get an email that might look like the following:

Hello [email protected]

Someone has invited you to http://localhost:3000/, you can accept it through the link below.

http://localhost:3000/admins/invitation/accept?invitation_token=-WnfTbPdgyxbnygwFPNj

If you don't want to accept the invitation, please ignore this email. Your account won't be created until you access the link above and set your password.

When the user navigates to this URL in the email, they will be taken to a page to accept this invitation and to set their account password:

image

After adding a password they will be logged in and redirected to the homepage (might want to change this to Admin CMS root page?). If they navigate to the CMS Admin they will be able to see everything. And their new admin account will be in the Admins index:
image

Some nice to haves and next steps:

  • Add additional test coverage here. I added 2 tests for testing that the new invitation screen is only available for logged in admin users. I also commented out 2 potential tests for testing the creating of an invite and accepting an invite. Think it be good to flush these out.
  • You can still create a new admin via the existing New Admin form (the link on the UI is gone, but route/code is still here for this). We should probably remove this now?
  • As always, CSS and UI changes might be needed/could be improved.
  • Emails. This feature uses Emails which we currently don't have in production (similar to the forgot password workflow in Devise Add authentication via devise #625 ). We will need to work with Neil to configure this or just use something easy (for the amount of emails we be sending from Library CMS (invitiations and forgot passwords), it might be easier to just use GMAIL or a free account from mailgun/sendgrid, etc. But perhaps Neil already has an email server we could use.
  • If we end up doing Omniauth and Ualberta Login, we should be able to use this functionality to invite users which they would then authenticate with Ualberta Login. Can maybe look at Correcting invitable synchronization with omniauthable? scambra/devise_invitable#177 for ideas for this.

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

Successfully merging this pull request may close these issues.

1 participant