What is the easiest way to restrict access to some part of the page?
In php i just put .htaccess and .htpasswd files in /admin folder and it
worked.
Now i’ve got one admin folder for controllers, one for views, public
folder and i’m not really sure if it’s still possible. So what is the
easiest way? I don’t have any user logging features on my site, because
i don’t need them. I want only to restric access to admin area.
I don’t have any user logging features on my site, because
i don’t need them. I want only to restric access to admin area.
I’m not sure I follow you here. You want to restrict it to certain
users, so
it seems to me that you need some kind of user-tracking - or how do you
know
who your user is?
In any case: I’d create (or copy) a login controller, then add a
before_filter to the controller for areas you want to restrict.
On php sites i had separate folder admin for all administration pages. I
just put there .htaccess and .htpasswd files which forced user to log to
gain access to this folder and all pages within it. That’s it. I didn’t
write any line of logging code (if i didn’t need it of course).
Is it possible to do the same - restrict access using just .htaccess and
.htpasswd files instead of creating login controller and write a code?
On php sites i had separate folder admin for all administration pages. I
just put there .htaccess and .htpasswd files which forced user to log to
gain access to this folder and all pages within it. That’s it. I didn’t
write any line of logging code (if i didn’t need it of course).
Is it possible to do the same - restrict access using just .htaccess and
.htpasswd files instead of creating login controller and write a code?
It’s outstandingly simple to add authentication to an existing Rails
app. Check out acts_as_authenticated and/or LoginEngine for a couple
of the many options available.