Invitation based authentication in Rails [closed] - ruby-on-rails

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I'm new to ROR and trying to build an invite based auth. Currently, I'm using Omniauth-facebook to have login using fb on my site. However, I want the users to have a custom url like - "www.mysite.com/invite/" which they can share to drive signup. I would also track these referrals so that I could incentivise users to drive such logins. I'm absolutely clueless about how to proceed and any starting pointers would be great.
One way could be to have a route for '/invite/:invite_code' and before the "/auth/facebook" is triggered I could read the invite code and increment the counter but then how do I check if the "/auth/facebook" was called from the invite page only. Does this sound correct? Or are there better solutions out there?
Thanks a lot!

You would make a POST to auth/facebook having more or less this code in you OmniAuth callbacks controller:
def facebook
Invitation.increment if request.env['omniauth.params'][:from_invitation_page]
# OR
# Invitation.increment if request.env['omniauth.origin'].match /your_invitation_url/
See that:
request.env['omniauth.origin']
is set automatically, while:
request.env['omniauth.params']
is set rendering a link like:
omniauth_authorize_path(:user, :facebook, var: 'value', var2: 'value2' )
Source

Related

Unable to use current_user.id in faye extension [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I am using devise and faye. and I want to track all online users. so i thought of including a faye extension. in faye/faye_current_user.rb . when i am using current_user.id in faye_current_user.rb it is throwing undefined variable error.
If you have anyother easy way to fetch online users please help me out.
The problem is that the "current_user" method from devise isn't being called before your method inside of faye_current_user.rb.
A working solution is dependent upon the where this file is located and how your set current_user before calling the methods within that file.

prevent users from adding content to rails site [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
When you make a site in rails, it creates some pages automatically that allow you to add conctent to your site. You usually acces them by typing domain.com/something/new in the browser.
Let's say you want to upload the site to the internet. How can you prevent users from accesing that pages? Deleting them doesn't seem like a good method because then how can you add conctent to the site? Do you password protect them? Is there some better way?
You can use devise to authenticate the user and call authenticate_user in the controller to ensure only authenticated users can go to that page. You can also take a look at cancan which gives you more control like setting read, write permissions.
There are possibly a hundred ways to do this. It depends on what you need and what you want.
If you don't want people to post stuff on your site and you don't need to do that yourself, why don't you just delete routing to /yourmodel/new from /app/controllers/yourmodel_controller.rb, /app/views/yourmodel/new.html.erb and the entry from /config/routes.rb?
Furthermore, you can use some gem for authentication. There are several. Have a look at clearance. It'll let you make some pages accessible for registered users only. If you want to hide a few pages from - let's say - common users so that only admins can access them, have a look at aegis.

how to add confirmation of user in authentication from mail? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I have authentication process but it saves the user when sign up and login can be done once sign up is completed. I want to send a mail to the user to conform the account, only then he must be able to login. How can i add this feature in my existing authentication system?
There is a pretty good gem that helps you with user authentication workflows. Devise can be found here: http://rubygems.org/gems/devise
But if you want to develop your own authentication system, you need to save the user on the database, and use a column for to manage the registration state (e.g. registered / confirmed).
To send e-mails to the user, please take a look at the action mailer documentation page: http://guides.rubyonrails.org/action_mailer_basics.html

facebook link recognizer for rails? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I am developing an app that allows users to post to walls/groups very much like facebook or a classic forum. I really like the way you can post a link on facebook and the link will be recognized as a video, pic, or other media and will automatically display. Its a great feature b/c it keeps users on facebook instead of leaving the site. On that note, I was looking to implement something similar for my the app I am developing. Are there any rails plugins/gems that do this kind of thing?
Yes, I know how to google and have done so. I realize that I could write regular expressions to scan the link and then take an according action. However, I am looking for an existing implementation to save a boat load of time.
Any and all input would be appreciated.
Existing implementations would probably be employing some form of regular expression, although another approach is using custom "Markdown" syntax or BB code to make the regular expression easier.

How do I create a poll on the facebook wall? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I want to create a poll on the facebook wall. Is it possible to do?
For some reason the creation of "questions" (aka polls) is not available yet in the API. If you want you should log a bug at developers.facebook.com/bugs and mark it as a wishlist item.
As far as I know it isn't possible.
You can only read questions with => "HTTP GET request to the /USER_ID/questions endpoint with the user_questions or friends_questions permissions"
...but I haven't tested it yet.
You can try one of many pre made poll apps, like this, just search for polls at the top in the apps, then install them on your page http://www.facebook.com/mypoll.page .
Another way would be to make an app that does the job, I have created apps before to add tabs to Facebook, you can put whatever you want on them then like a poll. Im not 100% how to post it to your wall without digging some more, but the example I posted above shows the poll posted on the wall.

Resources