Displaying 20 results from an estimated 31 matches for "sign_in".
2010 Jul 06
4
Simple routing problem
I''ve got the following in config\routes.rb:
map.resources :users
In app\views\shared\_menu.erb, I''ve got:
Please sign in <%= link_to
"here", :controller=>"user", :action=>"sign_in" -%>
In app\controllers\users_controller.rb
def sign_in
end
When I run the application, I crash with:
Routing Error
No route matches "/user/sign_in" with {:method=>:get}
I presume I should add "def sign_in; [snip]; end" somewhere in:
app\views\users
But where...
2013 Aug 22
1
duplicated log lines in console
...[2013-08-22 12:42:08] INFO WEBrick::HTTPServer#start: pid=13913 port=4000
Started GET "/oauth/authorized_applications" for 127.0.0.1 at 2013-08-22
12:42:12 +0200
Started GET "/oauth/authorized_applications" for 127.0.0.1 at 2013-08-22
12:42:12 +0200
Started GET "/users/sign_in" for 127.0.0.1 at 2013-08-22 12:42:13 +0200
Started GET "/users/sign_in" for 127.0.0.1 at 2013-08-22 12:42:13 +0200
Started POST "/users/sign_in" for 127.0.0.1 at 2013-08-22 12:46:39 +0200
Started POST "/users/sign_in" for 127.0.0.1 at 2013-08-22 12:46:39 +0200
*...
2013 Mar 20
2
Rspec + Devise + BaseController
...end
describe "before_filter#authenticate_admin!" do
before(:each) do
@admin = FactoryGirl.create(:admin)
@request.env["devise.mapping"] = Devise.mappings[:admin]
end
context "when admin is not logged in" do
it "redirect admin to sign_in path" do
get :index
response.should redirect_to new_admin_session_path
end
end
end
end
#####################################################
I''ve already inclueded Devise::TestHelpers on my spec_helper.rb and I''m
getting this error when running...
2012 May 12
12
before_save messing up
...rlsafe_base64
end
end
#sessions_controller.rb -------> Sessions Controller
class SessionsController < ApplicationController
def new
end
def create
user = User.find_by_email(params[:session][:email])
if user && user.authenticate(params[:session][:password])
sign_in user
redirect_to user
else
flash.now[''error''] = ''Invalid email/password combination''
render :new
end
end
def destroy
end
end
#sessions_helper.rb ------> Sessions Helper
module SessionsHelper
def sign_in(user)
cookies.p...
2013 Oct 07
0
rails_admin problem in raoutes, parallel login area in devise
hello friends,
i am using rails_admin as webapp admin interface. it create a User model by
default using Devise gem. after that i am creating another authorization
area member. now /admin route change to /member/sign_in from user/sign_in.
any body have idea how to create a parallel login area in devise with
rails_admin.
/admin => /user/sign_in (default)
after
* rails g devise member*.
it converted to
/admin => /member/sign_in
thanx in advance.
--
You received this message because you are subscribed to...
2008 Mar 13
22
Specifing methods in a steps_for block
Hey list,
I''m refactoring some much-used functionality into a common_steps step
group. Methods like this are in there:
steps_for :common do
Given "a number of existing $types?" do |type|
@initial_item_count = type.singularize.classify.constantize.count
end
When "the user adds an invalid $type" do |type|
post
2011 Jul 30
22
Question about Helpers
Studying the RoR 3 Tutorial book by Michael Hartl
and on page 345 there''s the code inside the SessionsHelper:
_________________________________________________________
module SessionsHelper
def sign_in(user)
cookies.permanent.signed[:remember_token] = [user.id, user.sault]
self.current_user = user
end
end
__________________________________________________________
What is the purpose of "self" inside the session helper?
I know that inside a model it refers to the class object.
For exam...
2011 Sep 24
0
Redirecting devise after login
hi,
i am using devise gem in my app for authentication. if i enter
link1 -> http://localhost:3000/users/sign_in,
once i login, it will be redirected to
link2 -> http://localhost:3000/user/dashboard.
if i can add new posts or comments for that user using this link
link3 ->
http://localhost:3000/community_managers/posts/new/2/Facebook
lets say i am using firebox.
If i copy tha...
2011 Aug 02
2
ror +auth_token + c#
HI,
i have to change a desktop app written in c# to post and get some data
to/from a rails app. the railsapp uses devise.
what im doing right now is:
1) pull up sign_in page
2) parse 1) for auth_token
3) post username+ pwd & auth_token
3.1) if 3 ok > goto 4)
4) post json data
that works all good, except that i do not provide auth_token in step4 , but
a) rails is still accepting my data. is that normal?
b) it seemsi cant not access attributes of current_use...
2011 Aug 02
2
ror +auth_token + c#
HI,
i have to change a desktop app written in c# to post and get some data
to/from a rails app. the railsapp uses devise.
what im doing right now is:
1) pull up sign_in page
2) parse 1) for auth_token
3) post username+ pwd & auth_token
3.1) if 3 ok > goto 4)
4) post json data
that works all good, except that i do not provide auth_token in step4 , but
a) rails is still accepting my data. is that normal?
b) it seemsi cant not access attributes of current_use...
2010 Sep 03
1
Action Controller Error: undefined local variable or method `current_user'
...ews/layouts/_header.html.erb:6:in
`_app_views_layouts__header_html_erb___1701013666_2174344740_524030''
app/views/layouts/application.html.erb:10:in
`_app_views_layouts_application_html_erb__1439570095_2174436720_0''
---- END
sessions_helper.rb CODE:
module SessionsHelper
def sign_in(user)
cookies.permanent.signed[:remember_token] = [user.id, user.salt]
current_user = user
end
def current_user=(user)
@current_user = user
end
def signed_in?
!current_user.nil?
end
def sign_out
cookies.delete(:remember_token)
self.current_user = nil
end
p...
2010 Apr 26
0
ActionController::RoutingError
.... I
have attached the code. Please help
routing.rb
map.connect '':controller/:action''
map.connect '':controller/:action/:id''
map.connect '':controller/:action/:id.:format''
Controller
class EntriesController < ApplicationController
def sign_in
@name = params[:visitor_name]
end
end
View
<html>
<head><title>Hello <%=h @name %></title></head>
<body>
<%=h @name %>
<% form_tag :action => ''sign_in'' do %>
<p>Enter your name:
<%= text_field_tag ''v...
2010 Nov 24
1
NameError in Devise/sessionsController#new
I created a sample application.
Added devise in it, it works fine.
Then added cancan gem into it.
Created an ability class. define some permissions.
Then added line
load_and_authorize_resource
to the Application Controller, after that when i go to the page
http://0.0.0.0:3000/users/sign_in it gave the following error,
NameError in Devise/sessionsController#new
uninitialized constant Session
Rails.root: /home/nazar/rails_projects/sample_can
Please help me, i can not solve this issue.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails...
2011 Jun 13
0
Devise Authorization Error
...ot sure.
Here is the relevant code:
--- routes.rb ---
# Root
root :to => "content#index"
# Admin Controllers
namespace ''admin'' do
root :to => "admin#index"
# AdminController
devise_for :admin, :path=> '''', :path_names => {:sign_in =>
''login'', :sign_out => ''logout''}
resources :admin
end
# UsersController
devise_for :users, :path_names => {:sign_in => ''login'', :sign_out =>
''logout''}
--- END routes.rb ---
--- admin.rb (Model) ---
class A...
2012 Oct 06
1
how to scope the /auth/:provider/callback , using OmniAuth for users and members
I have two separate groups of people authenticated w Devise , but in
this case I cannot used the Devise embedded OmniAuth support. So i am
using directly the OmniAuth gem.
Initialized w :
Rails.configuration.middleware.use OmniAuth::Builder do
..provider :twitter,
..
end
It''s running fine , but I have an issue with the callback route
mapping :
I tried
match
2010 Aug 08
2
issue with rescue_action_in_public! and testing 404 responses
...o I need to set something up for the rescue_action_in_public! to work? Or
is this not the correct way to test missing records?
My full example: (using factory_girl, rspec mocks and devise)
it "respons with 404 when trying to edit non-existing reads" do
rescue_action_in_public!
sign_in(@user)
Read.should_receive(:find_by_id_and_user_id!).with(2,
@user.id).and_raise(ActiveRecord::RecordNotFound)
get :edit, :id => 2
response.status.should eql 404
end
and the exception:
1) ReadsController resources respons with 404 for non existing reads for GET
/reads/2/edit...
2011 Nov 02
1
getting devise to return json data when signing out
....json {
if user_signed_in?
return render :json => {:success => true, :errors =>
["Already logged in."]}
end
resource = warden.authenticate!(:scope =>
resource_name, :recall => "#{controller_path}#failure")
return sign_in_and_redirect(resource_name, resource)
}
end
end
def sign_in_and_redirect(resource_or_scope, resource=nil)
scope = Devise::Mapping.find_scope!(resource_or_scope)
resource ||= resource_or_scope
sign_in(scope, resource) unless warden.user(scope) == resource...
2012 Feb 01
6
Does Devise make use of a "status" method? Weird bug.
...Take out the extra render, and it works.
What I can''t figure out for the life of me is how Devise is getting
there in the first place!
The problem is coming from the SessionsController#create method, but
this is just the stock version I''ve done nothing do it:
# POST /resource/sign_in
def create
resource = warden.authenticate!(:scope => resource_name, :recall =>
"#{controller_path}#new")
set_flash_message(:notice, :signed_in) if is_navigational_format?
sign_in(resource_name, resource)
respond_with resource, :location => after_sign_in_path_for...
2011 Jul 14
10
Devise confusing routes
...at night, it seemed like I fixed it.
But now, when I want to create a New User, it''s redirecting me to the
Sign In screen. Seems like I didn''t fix the problem completely.
I think Devise is confusing the routes. If I do rake routes, I get
this...
new_user_session GET /users/sign_in(.:format)
user_session POST /users/sign_in(.:format)
destroy_user_session DELETE /users/sign_out(.:format)
new_user GET /users/new(.:format)
edit_user GET /users/:id/edit(.:format)
user GET /users/:id(.:format)
This is routes.rb
devise_for :users, :controllers => { :registrations =...
2010 Jul 01
6
Close Modalpopup with RJS
...''rsecret''] = nil
profile = Twitter::Base.new(oauth).verify_credentials
user = User.find_or_create_by_screen_name(profile.screen_name)
user.update_attributes({
:atoken => oauth.access_token.token,
:asecret => oauth.access_token.secret,
})
sign_in(user)
# page << "window.close()"
redirect_to session[:return_to] rescue redirect_to :controller =>
"home"
# redirect_to :controller => "sessions/autoclose"
end
As you can see, by the commented out code, I attempted to push
"window.close()"...