Commit 55087b6a by liyijie

Fix auth code login bug

parent 3fff1e87
......@@ -19,17 +19,16 @@ module RailsApiAuthentication
render json: { message: "logout successful" }, status: 200
end
private 
def session_params
auth_key = self.class.klass.auth_key
auth_password = self.class.klass.auth_password
oauth_enable = self.class.oauth_enable
if oauth_enable
params.require(self.class.klass_sym).permit(auth_key, auth_password, :oauth_type, :oauth_id)
else
params.require(self.class.klass_sym).permit(auth_key, auth_password)
end
def session_params
auth_key = self.class.klass.auth_key
auth_password = self.class.klass.auth_password
oauth_enable = self.class.oauth_enable
if oauth_enable
params.require(self.class.klass_sym).permit(auth_key, auth_password, :oauth_type, :oauth_id)
else
params.require(self.class.klass_sym).permit(auth_key, auth_password)
end
end
module ClassMethods
attr_reader :klass, :klass_sym
......
......@@ -43,8 +43,8 @@ module RailsApiAuthentication
valid_for params.merge( { key: @auth_key} )
end
def oauth_for
@oauth_enable = params[:enable] || false
def oauth_for params={}
@oauth_enable = params[:enable] || true
@oauth_only = params[:only] || false
end
......
......@@ -17,10 +17,9 @@ module RailsApiAuthentication
render json: { message: "logout successful" }, status: 200
end
private 
def session_params
params.require(self.class.klass_sym).permit(:oauth_type, :oauth_id)
end
def session_params
params.require(self.class.klass_sym).permit(:oauth_type, :oauth_id)
end
module ClassMethods
attr_reader :klass, :klass_sym
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment