Stefan Gelenchev
2011-Jul-25 08:30 UTC
How to allow anonymous users to edit their posts by providing only it''s password?
I need some help with a small Classfieds site I''m currently trying to build. I am letting users publish their classfieds for free and without registering. But I also want to let them be able to edit their classfieds at a later point. That''s why I am asking them to provide a password for their classfied. What I need to do and can''t accomplish is: - Show a "login" form to the user - He has to provide the ID of the classfied ( he knows it, it''s in the description) - He has to provide the password he entered when creating the classfied If those 2 match he is redirected to the edit page of the classfied. The password is saved in the classfieds table. I can save it as a string or if your example needs it to be hashed, as a hashed_password + salt ( doesn''t matter to me ). Thank you for your help! -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Sandy
2011-Jul-25 18:00 UTC
Re: How to allow anonymous users to edit their posts by providing only it''s password?
I hope I''m mistaken, but this appears to be a trivial (<10 min.) homework assignment, in which case you should not be asking for assistance on this forum. Nevertheless, your database should have (at least) the following fields -- id (of course), ad information (string or text), and password (string). The form on which a user enters ad information should allow the user to input the password (which is then associated with the ad by id and password). The main page can then have an "Edit Ad" button (or link) that links to a login page which will have input boxes for the ad id (which may be displayed on the classified page) and the password. Alternatively, or in addition, the classified page can have an "Edit" button (or link) which goes to an Edit Current Ad page (where only the password is required, as the ad id should be passed as a hidden field). Either way, the Login or Edit Current Page should link to a page for editing the specified ad. I''m not sure what else your assignment calls for, but with the foregoing, you should be able to figure out how to create the database, create the views for adding a classified, displaying the classified (with the ad id and an "Edit" link), displaying a view with a link to a Login page, etc. If you have any other questions, please ask after you have some code to show. However, I don''t think anyone on here wants to do your complete homework project. On Jul 25, 4:30 am, Stefan Gelenchev <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I need some help with a small Classfieds site I''m currently trying to > build. > > I am letting users publish their classfieds for free and without > registering. But I also want to let them be able to edit their > classfieds at a later point. That''s why I am asking them to provide a > password for their classfied. > > What I need to do and can''t accomplish is: > > - Show a "login" form to the user > - He has to provide the ID of the classfied ( he knows it, it''s in > the description) > - He has to provide the password he entered when creating the > classfied > > If those 2 match he is redirected to the edit page of the classfied. > > The password is saved in the classfieds table. I can save it as a string > or if your example needs it to be hashed, as a hashed_password + salt ( > doesn''t matter to me ). > > Thank you for your help! > > -- > Posted viahttp://www.ruby-forum.com/.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.