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.
Related
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
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.
we have an app where the user get there own userspace an can create entries without login.
we generate an dynamic link
Like
localhost://apps/{owncode}/userspace
The owncode is calculated by us an the code will saved into the database
The user can add entries for his userspace.
localhost://apps/{owncode}/entries/new
How can I compare (check is its correct} the {owncode} from the database with the url. Because we want to catch if someone call the url by try and error.
You can't check that without forcing the user to log in. You should also not be using anything in the URL to identify their "userspace." It should all be tucked away in the session, associated with the logged in user's account.
If you at least want to make owncode hard to guess, you could generate a ridiculously long hashed string. But this is not recommended, it would not guarantee any security, and users could still try and guess the strings for other "userspaces" without your app being able to do anything about it.
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.
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 tried to find the answer to this question but could not, to be more precise, some apps like instagram have a custom backend, like they have a profile tab in the app where the users profile is stored, including the pics they upload.I want to know how is that page created, and how is the data saved to that page.So in short,if for my app I want to have a profile tab,how do I go about creating it, and how is the data storage done? I wanted to know whether the profile page under my profile tab is created, as in is it done in Xcode or some web design application and linked to Xcode?
Don't get me wrong, I'm not asking for the detailed process,just what software is used and a basic outline.
The back ends are PHP or any other server side languages, these are presented as service APIs interface, the most common is RESTful interfaces, the application connects to these RESTful services to store and retrieve data from
You may also want to read up on core data as any offline profile data is probably stored in core data or as NSUser Defaults.
http://developer.apple.com/library/ios/#DOCUMENTATION/DataManagement/Conceptual/iPhoneCoreData01/Introduction/Introduction.html
http://developer.apple.com/library/ios/#DOCUMENTATION/Cocoa/Reference/Foundation/Classes/NSUserDefaults_Class/Reference/Reference.html
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.