Jump to content

The ultimate community for Ruby on Rails developers.


Photo

Devise - Requiring Admin Approval for new User

devise views

  • Please log in to reply
3 replies to this topic

#1 meanwhileinfargo

meanwhileinfargo

    Passenger

  • Members
  • 2 posts

Posted 24 July 2014 - 02:29 AM

Hello all,

 

I built an app with devise and would like to add an admin approval requirement for any new users.  I followed this tutorial: https://github.com/p...-before-sign_in

 

I have everything working,  except I would like help  coding a view page so the logged in admin can actually  approve the new users.  How would I create a view to change the User model attribute :approved from false to true?  I've had success doing it in the console, but don't know how to code it into the view!

 

Thanks for any advice!



#2 Jamie

Jamie

    Controller

  • Moderators
  • 140 posts
  • LocationNewcastle, UK

Posted 24 July 2014 - 07:32 AM

Hello

 

Welcome to Railsforum.

 

While you're require new to Rails I'd suggest you check out Rails Admin to manage your backend until you're more comfortable with developing a custom solution.

 

Inside here you'll be able to approve users as and when you like.

 

I've have a look trying to add a mailer to send you a notification of a new user so you know someone requires approval. Depending on the type of site and if it's new, you may find users don't hang around waiting for approval. So perhaps an email verification process would be a better fit. Whatever your site needs, I'm sure you know.

 

All the best!

 

Regards,

Jamie


Rails developer based in Newcastle, UK.


#3 meanwhileinfargo

meanwhileinfargo

    Passenger

  • Members
  • 2 posts

Posted 25 July 2014 - 02:58 AM

Thanks for the suggestion Jamie!

Since I am designing an app for a company's internal use only, I don't see any issue with a User needing to hang around for approval from the Admin.  

 

I like your mailer idea.

 

Another idea I just came up with is requiring a User to input a valid secret code for a user to sign up).  Has anyone implementing this into a rails App?

 

 

Hello

 

Welcome to Railsforum.

 

While you're require new to Rails I'd suggest you check out Rails Admin to manage your backend until you're more comfortable with developing a custom solution.

 

Inside here you'll be able to approve users as and when you like.

 

I've have a look trying to add a mailer to send you a notification of a new user so you know someone requires approval. Depending on the type of site and if it's new, you may find users don't hang around waiting for approval. So perhaps an email verification process would be a better fit. Whatever your site needs, I'm sure you know.

 

All the best!

 

Regards,

Jamie



#4 Jamie

Jamie

    Controller

  • Moderators
  • 140 posts
  • LocationNewcastle, UK

Posted 25 July 2014 - 10:32 AM

Hi

 

Glad I help.

 

As for requiring a code to sign-up. I'd have a look at this gem which integrates with Devise nicely. It's designed for invite codes but the code is the same as what you'll need.

 

 

:)


Rails developer based in Newcastle, UK.






Also tagged with one or more of these keywords: devise, views

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users