On Tuesday, 29 December 2015 16:28:32 UTC-5, Michael Prieto wrote:
>
> Hello everyone o/
>
> I'm currently building a Rails app and I'm using Devise 
> <https://github.com/plataformatec/devise> and Omniauth 
> <https://github.com/intridea/omniauth> (Google OAuth2 and Facebook) for 
> authentication. All users are going to have unique usernames. This is not a 
> problem when I'm using just a form, but when the users tries to sign up 
> using Omniauth, I can't get a username that I can ensure is unique and fits 
> the criteria I've made for a valid username. If I do try to sign up with 
> it, it just redirects to the form that regular users would use to sign up.
>
> I've thought about redirecting the user to a separate page where they 
> create a username, but I don't know how I would go about this. Searching 
> the internet has not yielded any results either. 
>
> Does anyone know how I could accomplish this? I'm open to any ideas.
>
>
One way I've done similar things is by overriding 'after_sign_in_path_for'. 
See the Devise docs for an example:

https://github.com/plataformatec/devise/wiki/How-To:-redirect-to-a-specific-page-on-successful-sign-in#redirect-back-to-current-page-after-oauth-signin

Based on the requirements you've described, one option would be to check on 
sign-in to see if a user has no username and redirect them to a page that 
requests one. Your DB models may require some work to make it possible to 
create a "user" with an empty username.

--Matt Jones 

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/acd4eb84-b8ee-46f6-beba-1c384b3758dd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to