Re: Authentication in sinatra

Surya Poojary <[email protected]> Sun, 12 Jan 2020 16:37:34 +0530
Newsgroups gmane.comp.lang.ruby.general
Message-ID <CAANzoRGqGboV4up2--WEiADS+dqYAO05uzNpQt+EVEsajfm9Kw@mail.gmail.com>
--===============0798788883==
Content-Type: multipart/alternative; boundary="000000000000631ec8059bef5e22"

--000000000000631ec8059bef5e22
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

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 hav=
e 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 ? or
> 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=3Dunsubscrib=
e>
> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>
>

--000000000000631ec8059bef5e22
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto">Cool........thanks Ketan Bhai ..<div dir=3D"auto"><br></d=
iv><div dir=3D"auto">And also can we do like this ..</div><div dir=3D"auto"=
><br></div><div dir=3D"auto">Store the input used in username field and the=
 password field in instance variables..and the use and if statement to comp=
are it to our values ..if it doesn&#39;t match , redirect to &quot;/illegal=
&quot; login.</div><div dir=3D"auto"><br></div><div dir=3D"auto"><br></div>=
<div dir=3D"auto">Regards,</div><div dir=3D"auto">Surya.</div><div dir=3D"a=
uto"><br></div><div dir=3D"auto"><br></div><div dir=3D"auto">Regards,</div>=
<div dir=3D"auto"><br></div><div dir=3D"auto">Surya.</div></div><br><div cl=
ass=3D"gmail_quote"><div dir=3D"ltr">On Sun, 12 Jan 2020, 16:33 Ketan Patel=
, &lt;<a href=3D"mailto:[email protected]">[email protected]</a>&gt; wrote:<b=
r></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border=
-left:1px #ccc solid;padding-left:1ex">I assume so but different browsers m=
ay handle it differently, try the example in the previous link i sent you a=
nd play around with it.<br>
<br>
<br>
Ketan Patel<br>
<br>
<br>
<br>
&gt; On 12 Jan 2020, at 11:00, Surya Poojary &lt;<a href=3D"mailto:suryapjr=
@gmail.com" target=3D"_blank" rel=3D"noreferrer">[email protected]</a>&gt;=
 wrote:<br>
&gt; <br>
&gt; So if they open it again ..they have to enter the password again..righ=
t ?<br>
&gt; <br>
&gt; <br>
&gt; Regards,<br>
&gt; <br>
&gt; Surya.<br>
&gt; <br>
&gt; On Sun, 12 Jan 2020, 16:23 Ketan Patel, &lt;<a href=3D"mailto:ketpat@g=
mail.com" target=3D"_blank" rel=3D"noreferrer">[email protected]</a>&gt; wro=
te:<br>
&gt; Most browsers will cache the username/password so you don=E2=80=99t ha=
ve to enter it on every page reload and will delete them when the browser i=
s closed.<br>
&gt; <br>
&gt; Ketan Patel<br>
&gt; <br>
&gt; <br>
&gt; <br>
&gt; &gt; On 12 Jan 2020, at 10:43, Surya Poojary &lt;<a href=3D"mailto:sur=
[email protected]" target=3D"_blank" rel=3D"noreferrer">[email protected]</a=
>&gt; wrote:<br>
&gt; &gt; <br>
&gt; &gt; 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>
&gt; &gt; <br>
&gt; &gt; <br>
&gt; &gt; Regards,<br>
&gt; &gt; <br>
&gt; &gt; Surya.<br>
&gt; &gt; <br>
&gt; &gt; On Sun, 12 Jan 2020, 16:03 Ketan Patel, &lt;<a href=3D"mailto:ket=
[email protected]" target=3D"_blank" rel=3D"noreferrer">[email protected]</a>&gt=
; wrote:<br>
&gt; &gt; The easiest thing to start with is HTTP basic auth, have a look h=
ere: <a href=3D"http://sinatrarb.com/faq.html#auth" rel=3D"noreferrer noref=
errer" target=3D"_blank">http://sinatrarb.com/faq.html#auth</a>.<br>
&gt; &gt; <br>
&gt; &gt; Ketan Patel<br>
&gt; &gt; <br>
&gt; &gt; <br>
&gt; &gt; &gt; On 12 Jan 2020, at 10:15, Surya Poojary &lt;<a href=3D"mailt=
o:[email protected]" target=3D"_blank" rel=3D"noreferrer">[email protected]=
om</a>&gt; wrote:<br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; Dear Rubyists,<br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; I&#39;m a web developer newbie , learning sinatra . I&#39;m =
planning to build my own notes web app. Since it&#39;s for my personal use =
, I want the home page to be a classic login page where I can enter my user=
name and password and then it should show me all my notes otherwise it shou=
ldn&#39;t show . <br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; How do I achieve this with Sinatra?<br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; Regards,<br>
&gt; &gt; &gt; Surya.<br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; Unsubscribe: &lt;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&gt;<br>
&gt; &gt; &gt; &lt;<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>&gt;<br>
&gt; &gt; <br>
&gt; &gt; <br>
&gt; &gt; Unsubscribe: &lt;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&gt;<br>
&gt; &gt; &lt;<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>&gt;<br>
&gt; &gt; <br>
&gt; &gt; Unsubscribe: &lt;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&gt;<br>
&gt; &gt; &lt;<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>&gt;<br>
&gt; <br>
&gt; <br>
&gt; Unsubscribe: &lt;mailto:<a href=3D"mailto:ruby-talk-request@ruby-lang.=
org" target=3D"_blank" rel=3D"noreferrer">[email protected]</=
a>?subject=3Dunsubscribe&gt;<br>
&gt; &lt;<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>&gt;<br>
&gt; <br>
&gt; Unsubscribe: &lt;mailto:<a href=3D"mailto:ruby-talk-request@ruby-lang.=
org" target=3D"_blank" rel=3D"noreferrer">[email protected]</=
a>?subject=3Dunsubscribe&gt;<br>
&gt; &lt;<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>&gt;<br>
<br>
<br>
Unsubscribe: &lt;mailto:<a href=3D"mailto:[email protected]" =
target=3D"_blank" rel=3D"noreferrer">[email protected]</a>?su=
bject=3Dunsubscribe&gt;<br>
&lt;<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>&gt;<br>
</blockquote></div>

--000000000000631ec8059bef5e22--

--===============0798788883==
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>

--===============0798788883==--