codepedia

This commit is contained in:
cxt 2017-11-06 15:00:54 +08:00
parent 0375d86fa6
commit a2908e84f4
2 changed files with 14 additions and 0 deletions

View File

@ -21,6 +21,7 @@ class AccountController < ApplicationController
# prevents login action to be filtered by check_if_login_required application scope filter
skip_before_filter :check_if_login_required
skip_before_filter :verify_authenticity_token, :only =>[:codepedia_login]
# Login request and validation
def login
if params[:type] == "activated"
@ -49,6 +50,18 @@ class AccountController < ApplicationController
end
end
def codepedia_login
logger.info("codepedia_login#########################################")
logger.info("#{params}")
user, last_login_on = User.try_to_login(params[:username], params[:password])
logger.info(user)
if user.blank?
render :json => { status: 0 }
else
render :json => { status: 1, user: user}
end
end
# 服务协议
def agreement
render :layout => 'static_base'

View File

@ -532,6 +532,7 @@ RedmineApp::Application.routes.draw do
match 'account/change_email', :via => :get
match 'account/email_valid', :to => 'account#email_valid', :via => :get
match 'account/resendmail', :to => 'account#resendmail', :via=> :get, :as => 'resendmail'
match 'account/codepedia_login', :to => 'account#codepedia_login', :via => [:get, :post]
match 'projects/:id/wiki', :to => 'wikis#edit', :via => :post
match 'projects/:id/wiki/destroy', :to => 'wikis#destroy', :via => [:get, :post]