Displaying 20 results from an estimated 84 matches for "logged_in".
2006 Dec 11
2
Does mongrel look at the Rails page cache?
Hi all. I''m trying to skip the Rails page cache if the user is logged
in:
---
# Rewrite index to check for static
RewriteCond %{HTTP_COOKIE} !^.*logged_in=yes.*$
RewriteRule ^/$ /index.html [QSA]
# Rewrite to check for Rails cached page
RewriteCond %{HTTP_COOKIE} !^.*logged_in=yes.*$
RewriteRule ^([^.]+)$ $1.html [QSA]
# Redirect all non-static requests to cluster
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://m...
2007 Feb 11
1
Specing Rails Views
Hello -
I''m currently trying to write some specs for my rails views. My
views depend upon
the restful authentication plugin method logged_in? Like so,
<% if logged_in? %>
<ul id="product-admin-nav">
<dd><%= link_to "create a new product", new_product_url %></dd>
</ul>
<% end %>
However, when I have the following in my specification:
render "products/show&quo...
2006 Jul 13
8
Acts As Authenticated - smarter login box
Hi,
I''ve got AAA loaded and working. I now want to put a smarter login form
on the sidebar of my site.
If the user is not logged in, I''d like to display a typical form in the
sidebar that collects the user ID/password and allows the user to login.
If the user is logged in, the box should display something like ''Logged
in user: FirstName Lastname'' and a
2007 Oct 01
15
how to spec views
...ew render different partials depending on authentication of the user:
annon, admin, player
So I I''ll write if conditionals in the view with the partials
it "should render signup propaganda for annon users trying to view games"
do
render "/games/index.rhtml"
@logged_in?.should eql(false)
response.should render_template(''_signup_propaganda'')
end
Now for my partial I know it''ll be wrapped all in a div with a
class="signup_propaganda"
Should I be testing for that instead? Can I write expectations for partials
similar to ab...
2007 Jun 24
2
howto make "logged_in?" accessible to other controllers? aaa
Greetings,
I am new to act as autenticated and was wondering how i can check if the
user has been logged in from their account. i would like to do this so
i can show things a member can do in the main site (vote, comment, etc)
thanks!
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
2010 Jan 22
5
Rails Render Issue
Hi,
I am adding login functionality to my app which has two controllers
users and photos and i am having some trouble.
In my users/index view
<%if logged_in? %>
<%=render "photos/index"%>
<%else%>
.... Home page With login.....
<%end%>
In my photos/index view
<%if logged_in? %>
.... Welcome page .....
<%else%>
<%=render "users/index"%>
<%end%>...
2008 Jan 30
2
Where can I get "authenticate_with_http_basic"?
...ion Trace | Framework Trace | Full Trace
/usr/local/apache2/htdocs/easyrx/lib/authenticated_system.rb:102:in
`login_from_basic_auth''
/usr/local/apache2/htdocs/easyrx/lib/authenticated_system.rb:12:in
`current_user''
/usr/local/apache2/htdocs/easyrx/lib/authenticated_system.rb:6:in
`logged_in?''
/usr/local/apache2/htdocs/easyrx/app/controllers/
register_controller.rb:41:in `start''
How can I troubleshoot this? Below is the code for my
autehnticated_system.rb file, installed by the plugin. - Dave
====================begin
authenticated_system.rb========================...
2007 May 29
5
Trouble defining a stub method for a controller
Hello,
Not sure if I am doing something really wrong (let''s not say
stupid for now), but I haven''t been able to stub a controller method
like:
controller.stub!(:logged_in?).and_return(true)
Please help, this is driving me nuts ;-)
--
An?bal Rojas
http://www.rubycorner.com
http://www.hasmanydevelopers.com
2008 Aug 08
2
template.expect_render fails when partial is rendered from a helper
My spec;
describe ''subnav rendering while logged in'' do
before do
template.stub!(:logged_in?).and_return(true)
template.stub!
(:current_profile).at_least(:once).and_return(mock_profile)
end
def do_render
render "/homepages/show.html.erb"
end
it "should render the logged in partial for homepages" do
template.expect_render(:partial =&g...
2006 Apr 23
2
Check if current route == some route
...pplicationController in which I want to check
if the current location is the same as a certain route, so that I only
redirect non-logged in visitors to the "join" page if they''re not on
that page already.
The code I came up with is a bit ugly:
redirect_to join_url unless (@logged_in or action_name == "join")
I''m pretty sure there is some nice way of doing this, along the lines of
... current_url == join_url
but I can''t seem to find it on Google, nor does #rubyonrails know.
Anyone?
Another way to solve this would be :exclude on the filter, but...
2008 Jun 13
3
before_filter order of execution
...oller, but only users with a
access_level higher than 2 can view specific objects. My code is:
-----------------------------------------------------------
IN USER_CONTROLLER
before_filter :login_required
before_filter :access_granted, :only => [:destroy, :new , :edit]
IN APPLICATION.RB
def logged_in?
! @current_user.blank?
end
helper_method :logged_in?
def login_required
return true if logged_in?
session[:return_to] = request.request_uri
redirect_to :controller => "/account", :action => "login" and return
false
end
def access_granted
if...
2015 Mar 17
2
[patch] Updated patch for pkcs#11 smartcard readers that have a protected PIN path
...index c3a112f..b053332 100644
--- a/ssh-pkcs11.c
+++ b/ssh-pkcs11.c
@@ -255,22 +255,30 @@ pkcs11_rsa_private_encrypt(int flen, const u_char *from, u_char *to, RSA *rsa,
si = &k11->provider->slotinfo[k11->slotidx];
if ((si->token.flags & CKF_LOGIN_REQUIRED) && !si->logged_in) {
if (!pkcs11_interactive) {
- error("need pin");
+ error("need pin%s",
+ (si->token.flags & CKF_PROTECTED_AUTHENTICATION_PATH)
+ ? " entry on reader keypad" : "");
return (-1);
}
- snprintf(prompt, sizeof(prompt), "Enter...
2007 Jan 04
8
Common setup code and naming specifications
Hello!
I have a lot of contexts for testing Rails controllers, that must do
something like ''session[:logged_in] = true'' in their setup. How can this
be refactored? In unit tests I would simply create a
LoggedInControllerTest base class, that all my functional tests would
derive from.
And another small question:
In my controller specifications I often have to decide whether to write:
specify &quo...
2006 Apr 12
3
acts_as_authenticated trouble
...els all work fine. The user is directed
to ''/signup'' on loading, and upon signing up, everything inserts into
the database correctly, but when I log in, no session is retained.
In my account_controller file, I changed
redirect_to(:action => ''signup'') unless logged_in? or Account.count > 0
to
redirect_to(:action => ''signup'') unless logged_in?
and my application is in limbo.
I haven''t even attempted to get the mailer running yet, and I figure my
problem is absurdly easy. But I''d like to get it out of the way.
thanks...
2008 Dec 16
20
step definitons to check login
I am working with the authlogic gem and trying to create a simple login
test from cucumber features. The feature statement is:
Given the user is not logged in
The step definition for this is confounding me. In the
application_controller the authlogic tutorial recommends the following:
private
def require_user
unless current_user
store_location
flash[:notice] =
2007 Jul 06
3
stubbing helper methods for View specs
Hi there
I have several view specs, that include the following snippet in
their "before" block to stub the methods by acts_as_authenticated
before :each do
@u = mock_model(User)
@u.should_receive(:name).and_return("Hans Muster")
template.should_receive(:logged_in?).and_return(true)
template.should_receive(:current_user).and_return(@u)
end
this works for views / helpers like this:
it "should show bla" do
render "/layouts/thetool"
response.should have_tag("p", "bla")
end
and the view (haml to...
2007 Oct 26
2
Examples of writing controller specs that use authentication
Hello,
I''m working on specs for a controller that handles authentication
using the restful_authentication plugin. I''m trying to find a
resource (tutorial or examples, if possible) about the best way to go
about writing mocks and specs to make sure that things like my
before_filters are working correctly. Does anyone know of any good
resources for this?
Thanks,
Les
2006 Jan 30
10
form_remote_tag and redirects
..._tag(:update => ''message'',
:complete => evaluate_remote_response,
:url => {:controller => ''login'',
:action => ''login''}) %>
The Action
============
if logged_in
render(:text => "window.location.href = ''http://0.0.0.0:3000/admin'';")
else
render(:layout => false, :action => ''bad_login'') <-- which is just a
template with an Effect.Shake
So, is there any other way to do a redirect from an acti...
2008 Apr 30
4
what is .....undefined method `authenticate'
def login_submit
if session[''user'']
@logged_in = true
else
@logged_in = false
end
@user = User.new(params[''user''])
if session[''user''] = User.authenticate(params[''user''][''username''],
params[''user''][''password''])...
2007 May 17
2
Stubbing authentication across multiple controllers
Hi,
I''m new to RSpec, so I''m not too sure of the best practises in stubbing. I was thinking along the lines of including a helper method that would stub out a users id and posts to sessions/create. It works fine when speccing SessionsController, but of course it fails when it is included into other controllers specs, because of the post. I''ve tried posting to an