In my rails application I am using devise
gem for to manage users. I am using mobile_fu
gem for to separate users coming from different users.
What I want to achieve here is:
MSISDN
number reading header it is already doneMSISDN
number falls in a particular series then I want to automatic login that user to my website so that he will not have to fill the sign_in form.How I can achieve this?
You have to:
1) Register the user into the website for devise. 2) Login the user.
For option 1, you can do something like:
user = User.find_by_msisdn(params[:msisdn])
if user.nil?
user = User.create(field_1: value1, field_2: value2)
end
sign_in(user)
redirect_to after_sign_in_path(user)
The things to have in mind, the first line tries to find for the user, on the second line, if it cannot find the user, it creates the user right away, then it sign_in the user, and finally redirect the user to where he should go after the login.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With