Re: Authentication in sinatra
Surya Poojary <[email protected]> Sun, 12 Jan 2020 17:00:19 +0530
| Newsgroups | gmane.comp.lang.ruby.general |
|---|---|
| Message-ID | <CAANzoRG-zJpaK6hHL3dPAZPGF=B93P93e07AqSeJ626eByNHYg@mail.gmail.com> |
--===============0092905001== Content-Type: multipart/alternative; boundary="000000000000b85246059befafc9" --000000000000b85246059befafc9 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Gracias ! Ketan ! Regards, Surya. On Sun, 12 Jan 2020, 16:55 Ketan Patel, <[email protected]> wrote: > That would technically work but other than redirecting to a path it=E2=80= =99s not > doing anything that HTTP Basic Auth isn=E2=80=99t already doing, unless o= f course > you wanted a custom login form, in which case you would need to handle > session cookies so users=E2=80=99 don=E2=80=99t have to login every time.= See > https://learn.co/lessons/sinatra-sessions > > My advise is to not get too caught up in this. Since this is a personal > web site, focus on making the notes application and use HTTP Basic Auth > until you find it=E2=80=99s not enough. > > Ketan Patel > > > > On 12 Jan 2020, at 11:07, Surya Poojary <[email protected]> wrote: > > > > Cool........thanks Ketan Bhai .. > > > > And also can we do like this .. > > > > Store the input used in username field and the password field in > instance variables..and the use and if statement to compare it to our > values ..if it doesn't match , redirect to "/illegal" login. > > > > > > Regards, > > Surya. > > > > > > Regards, > > > > Surya. > > > > On Sun, 12 Jan 2020, 16:33 Ketan Patel, <[email protected]> wrote: > > I assume so but different browsers may handle it differently, try the > example in the previous link i sent you and play around with it. > > > > > > Ketan Patel > > > > > > > > > On 12 Jan 2020, at 11:00, Surya Poojary <[email protected]> wrote: > > > > > > So if they open it again ..they have to enter the password > again..right ? > > > > > > > > > Regards, > > > > > > Surya. > > > > > > On Sun, 12 Jan 2020, 16:23 Ketan Patel, <[email protected]> wrote: > > > Most browsers will cache the username/password so you don=E2=80=99t h= ave to > enter it on every page reload and will delete them when the browser is > closed. > > > > > > Ketan Patel > > > > > > > > > > > > > On 12 Jan 2020, at 10:43, Surya Poojary <[email protected]> wrote: > > > > > > > > Will it ask for authentication everytime someone visits the URL ? o= r > is it if I enter correct combination once,it will not ask again .? > > > > > > > > > > > > Regards, > > > > > > > > Surya. > > > > > > > > On Sun, 12 Jan 2020, 16:03 Ketan Patel, <[email protected]> wrote: > > > > The easiest thing to start with is HTTP basic auth, have a look > here: http://sinatrarb.com/faq.html#auth. > > > > > > > > Ketan Patel > > > > > > > > > > > > > On 12 Jan 2020, at 10:15, Surya Poojary <[email protected]> > wrote: > > > > > > > > > > Dear Rubyists, > > > > > > > > > > I'm a web developer newbie , learning sinatra . I'm planning to > build my own notes web app. Since it's for my personal use , I want the > home page to be a classic login page where I can enter my username and > password and then it should show me all my notes otherwise it shouldn't > show . > > > > > > > > > > How do I achieve this with Sinatra? > > > > > > > > > > Regards, > > > > > Surya. > > > > > > > > > > > > > > > Unsubscribe: <mailto:[email protected] > ?subject=3Dunsubscribe> > > > > > <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk> > > > > > > > > > > > > Unsubscribe: <mailto:[email protected] > ?subject=3Dunsubscribe> > > > > <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk> > > > > > > > > Unsubscribe: <mailto:[email protected] > ?subject=3Dunsubscribe> > > > > <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk> > > > > > > > > > Unsubscribe: <mailto:[email protected] > ?subject=3Dunsubscribe> > > > <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk> > > > > > > Unsubscribe: <mailto:[email protected] > ?subject=3Dunsubscribe> > > > <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk> > > > > > > Unsubscribe: <mailto:[email protected] > ?subject=3Dunsubscribe> > > <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk> > > > > Unsubscribe: <mailto:[email protected] > ?subject=3Dunsubscribe> > > <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk> > > > Unsubscribe: <mailto:[email protected]?subject=3Dunsubscrib= e> > <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk> > --000000000000b85246059befafc9 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"auto">Gracias ! Ketan !<div dir=3D"auto"><br></div><div dir=3D"= auto">Regards,</div><div dir=3D"auto">Surya.</div></div><br><div class=3D"g= mail_quote"><div dir=3D"ltr">On Sun, 12 Jan 2020, 16:55 Ketan Patel, <<a= href=3D"mailto:[email protected]">[email protected]</a>> wrote:<br></div>= <blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p= x #ccc solid;padding-left:1ex">That would technically work but other than r= edirecting to a path it=E2=80=99s not doing anything that HTTP Basic Auth i= sn=E2=80=99t already doing, unless of course you wanted a custom login form= , in which case you would need to handle session cookies so users=E2=80=99 = don=E2=80=99t have to login every time. See <a href=3D"https://learn.co/les= sons/sinatra-sessions" rel=3D"noreferrer noreferrer" target=3D"_blank">http= s://learn.co/lessons/sinatra-sessions</a> <br> <br> My advise is to not get too caught up in this. Since this is a personal web= site, focus on making the notes application and use HTTP Basic Auth until = you find it=E2=80=99s not enough.<br> <br> Ketan Patel<br> <br> <br> > On 12 Jan 2020, at 11:07, Surya Poojary <<a href=3D"mailto:suryapjr= @gmail.com" target=3D"_blank" rel=3D"noreferrer">[email protected]</a>>= wrote:<br> > <br> > Cool........thanks Ketan Bhai ..<br> > <br> > And also can we do like this ..<br> > <br> > Store the input used in username field and the password field in insta= nce variables..and the use and if statement to compare it to our values ..i= f it doesn't match , redirect to "/illegal" login.<br> > <br> > <br> > Regards,<br> > Surya.<br> > <br> > <br> > Regards,<br> > <br> > Surya.<br> > <br> > On Sun, 12 Jan 2020, 16:33 Ketan Patel, <<a href=3D"mailto:ketpat@g= mail.com" target=3D"_blank" rel=3D"noreferrer">[email protected]</a>> wro= te:<br> > I assume so but different browsers may handle it differently, try the = example in the previous link i sent you and play around with it.<br> > <br> > <br> > Ketan Patel<br> > <br> > <br> > <br> > > On 12 Jan 2020, at 11:00, Surya Poojary <<a href=3D"mailto:sur= [email protected]" target=3D"_blank" rel=3D"noreferrer">[email protected]</a= >> wrote:<br> > > <br> > > So if they open it again ..they have to enter the password again.= .right ?<br> > > <br> > > <br> > > Regards,<br> > > <br> > > Surya.<br> > > <br> > > On Sun, 12 Jan 2020, 16:23 Ketan Patel, <<a href=3D"mailto:ket= [email protected]" target=3D"_blank" rel=3D"noreferrer">[email protected]</a>>= ; wrote:<br> > > Most browsers will cache the username/password so you don=E2=80= =99t have to enter it on every page reload and will delete them when the br= owser is closed.<br> > > <br> > > Ketan Patel<br> > > <br> > > <br> > > <br> > > > On 12 Jan 2020, at 10:43, Surya Poojary <<a href=3D"mailt= o:[email protected]" target=3D"_blank" rel=3D"noreferrer">[email protected]= om</a>> wrote:<br> > > > <br> > > > Will it ask for authentication everytime someone visits the = URL ? or is it if I enter correct combination once,it will not ask again .?= <br> > > > <br> > > > <br> > > > Regards,<br> > > > <br> > > > Surya.<br> > > > <br> > > > On Sun, 12 Jan 2020, 16:03 Ketan Patel, <<a href=3D"mailt= o:[email protected]" target=3D"_blank" rel=3D"noreferrer">[email protected]</= a>> wrote:<br> > > > The easiest thing to start with is HTTP basic auth, have a l= ook here: <a href=3D"http://sinatrarb.com/faq.html#auth" rel=3D"noreferrer = noreferrer" target=3D"_blank">http://sinatrarb.com/faq.html#auth</a>.<br> > > > <br> > > > Ketan Patel<br> > > > <br> > > > <br> > > > > On 12 Jan 2020, at 10:15, Surya Poojary <<a href=3D"= mailto:[email protected]" target=3D"_blank" rel=3D"noreferrer">suryapjr@gm= ail.com</a>> wrote:<br> > > > > <br> > > > > Dear Rubyists,<br> > > > > <br> > > > > I'm a web developer newbie , learning sinatra . I&#= 39;m planning to build my own notes web app. Since it's for my personal= use , I want the home page to be a classic login page where I can enter my= username and password and then it should show me all my notes otherwise it= shouldn't show . <br> > > > > <br> > > > > How do I achieve this with Sinatra?<br> > > > > <br> > > > > Regards,<br> > > > > Surya.<br> > > > > <br> > > > > <br> > > > > Unsubscribe: <mailto:<a href=3D"mailto:ruby-talk-req= [email protected]" target=3D"_blank" rel=3D"noreferrer">ruby-talk-request@= ruby-lang.org</a>?subject=3Dunsubscribe><br> > > > > <<a href=3D"http://lists.ruby-lang.org/cgi-bin/mailm= an/options/ruby-talk" rel=3D"noreferrer noreferrer" target=3D"_blank">http:= //lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk</a>><br> > > > <br> > > > <br> > > > Unsubscribe: <mailto:<a href=3D"mailto:ruby-talk-request@= ruby-lang.org" target=3D"_blank" rel=3D"noreferrer">ruby-talk-request@ruby-= lang.org</a>?subject=3Dunsubscribe><br> > > > <<a href=3D"http://lists.ruby-lang.org/cgi-bin/mailman/op= tions/ruby-talk" rel=3D"noreferrer noreferrer" target=3D"_blank">http://lis= ts.ruby-lang.org/cgi-bin/mailman/options/ruby-talk</a>><br> > > > <br> > > > Unsubscribe: <mailto:<a href=3D"mailto:ruby-talk-request@= ruby-lang.org" target=3D"_blank" rel=3D"noreferrer">ruby-talk-request@ruby-= lang.org</a>?subject=3Dunsubscribe><br> > > > <<a href=3D"http://lists.ruby-lang.org/cgi-bin/mailman/op= tions/ruby-talk" rel=3D"noreferrer noreferrer" target=3D"_blank">http://lis= ts.ruby-lang.org/cgi-bin/mailman/options/ruby-talk</a>><br> > > <br> > > <br> > > Unsubscribe: <mailto:<a href=3D"mailto:ruby-talk-request@ruby-= lang.org" target=3D"_blank" rel=3D"noreferrer">ruby-talk-request@ruby-lang.= org</a>?subject=3Dunsubscribe><br> > > <<a href=3D"http://lists.ruby-lang.org/cgi-bin/mailman/options= /ruby-talk" rel=3D"noreferrer noreferrer" target=3D"_blank">http://lists.ru= by-lang.org/cgi-bin/mailman/options/ruby-talk</a>><br> > > <br> > > Unsubscribe: <mailto:<a href=3D"mailto:ruby-talk-request@ruby-= lang.org" target=3D"_blank" rel=3D"noreferrer">ruby-talk-request@ruby-lang.= org</a>?subject=3Dunsubscribe><br> > > <<a href=3D"http://lists.ruby-lang.org/cgi-bin/mailman/options= /ruby-talk" rel=3D"noreferrer noreferrer" target=3D"_blank">http://lists.ru= by-lang.org/cgi-bin/mailman/options/ruby-talk</a>><br> > <br> > <br> > Unsubscribe: <mailto:<a href=3D"mailto:ruby-talk-request@ruby-lang.= org" target=3D"_blank" rel=3D"noreferrer">[email protected]</= a>?subject=3Dunsubscribe><br> > <<a href=3D"http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby= -talk" rel=3D"noreferrer noreferrer" target=3D"_blank">http://lists.ruby-la= ng.org/cgi-bin/mailman/options/ruby-talk</a>><br> > <br> > Unsubscribe: <mailto:<a href=3D"mailto:ruby-talk-request@ruby-lang.= org" target=3D"_blank" rel=3D"noreferrer">[email protected]</= a>?subject=3Dunsubscribe><br> > <<a href=3D"http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby= -talk" rel=3D"noreferrer noreferrer" target=3D"_blank">http://lists.ruby-la= ng.org/cgi-bin/mailman/options/ruby-talk</a>><br> <br> <br> Unsubscribe: <mailto:<a href=3D"mailto:[email protected]" = target=3D"_blank" rel=3D"noreferrer">[email protected]</a>?su= bject=3Dunsubscribe><br> <<a href=3D"http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk= " rel=3D"noreferrer noreferrer" target=3D"_blank">http://lists.ruby-lang.or= g/cgi-bin/mailman/options/ruby-talk</a>><br> </blockquote></div> --000000000000b85246059befafc9-- --===============0092905001== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline Unsubscribe: <mailto:[email protected]?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk> --===============0092905001==--