cloud for api and doemal

This commit is contained in:
Yan
2018-04-11 11:27:05 +06:30
parent 70cd6576b1
commit 04ae741462
5 changed files with 60 additions and 8 deletions

View File

@@ -15,8 +15,15 @@ module TokenVerification
def authenticate_token
authenticate_with_http_token do |token, options|
#@current_user = User.find_by(api_key: token)
Rails.logger.debug "token - " + token.to_s
# Rails.logger.debug "token - " + token.to_s
if(!options.from.nil? && options.from == "DOEMAL"){
if(ENV["SERVER_MODE"] === "cloud"){
from = request.subdomain.downcase + "." + request.domain.downcase
aes = MyAesCrypt.new
return aes.checkKeyForAuth(from, token)
}
}
@user = Employee.authenticate_by_token(token)
if @user
return true