나는 Devise가 필요로하는 모든 것을 설정했다. 그리고 일들이 나를 위해 잘 작동합니다.
그러나 매우 짜증나는 한 가지이다 : 나는 브라우저를 통해 인증을 필요로하는 페이지를 요청하면
은 (파이어 폭스) .IT 그냥 경고 대화 상자가 튀어 말한다 :Devise 플러그인의 문제. (레일스)
"A username and password are being requested by http://localhost:3001. The site says: "Application"'
와 로그인 페이지 ("/ users/sign_in"페이지)로 리디렉션하는 대신 사용자 이름과 비밀번호 입력 필드를 입력하십시오. 그러나 입력 한 사용자 이름과 비밀번호에 관계없이 액세스 할 수 없습니다. "/ users/sign_in"과 같은 정보).
도움말 내 모델
업데이트 :(하십시오 (비계에서 생성)
class Account < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable, :lockable and :timeoutable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me
end
내 컨트롤러 :
class ThingsController < ApplicationController
before_filter :authenticate_account!, :except => ['show', 'index']
# GET /things
# GET /things.xml
def index
@things = Thing.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @things }
end
end
# GET /things/1
# GET /things/1.xml
def show
@thing = Thing.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @thing }
end
end
# GET /things/new
# GET /things/new.xml
def new
@thing = Thing.new
....
당신이 필요로하는 경우를 더 많은 정보, pl 쉽게 알려주세요 :)
기본 인증을 사용하는 것으로 보입니다. 나는 그것을 불가능하게하는 방법에 대한 힌트를 줄만큼 충분히 고안 한 것을 모른다. – Augusto
Augusto에 감사드립니다. 문제가 거의 해결되었습니다. 내가 주위에 인터넷 검색하지만 여전히 완벽한 해결책을 찾을 수 있지만 이것을 찾으십시오 : http://ewout.name/2010/04/http-basic-authentication-with-devise/하지만 새로운 오류가 나타납니다 : "초기화되지 않은 상수 Devise :: Strategies :: HttpAuthenticatable (NameError) " – Croplio
얘들 아, 도움 !!!!!!!!!! – Croplio