Code cleanup.

This commit is contained in:
Martin Edenhofer 2012-04-20 09:07:07 +02:00
parent 0dd055f2eb
commit 335751f133
3 changed files with 1 additions and 17 deletions

View file

@ -32,7 +32,6 @@ class SessionsController < ApplicationController
# check logon session # check logon session
logon_session_key = nil logon_session_key = nil
if params['logon_session'] if params['logon_session']
puts 'create sessions session con'
logon_session_key = Digest::MD5.hexdigest( rand(999999).to_s + Time.new.to_s ) logon_session_key = Digest::MD5.hexdigest( rand(999999).to_s + Time.new.to_s )
ActiveRecord::SessionStore::Session.create( ActiveRecord::SessionStore::Session.create(
:session_id => logon_session_key, :session_id => logon_session_key,

View file

@ -4,7 +4,7 @@ class TicketOverviewsController < ApplicationController
# GET /tickets # GET /tickets
# GET /tickets.json # GET /tickets.json
def show def show
# build up attributes hash # build up attributes hash
overview_selected = nil overview_selected = nil
overviews = Overview.all overviews = Overview.all

View file

@ -15,29 +15,15 @@ class User < ApplicationModel
def self.authenticate( username, password ) def self.authenticate( username, password )
user = User.where( :login => username, :active => true ).first user = User.where( :login => username, :active => true ).first
return nil if user.nil? return nil if user.nil?
logger.debug 'auth'
logger.debug username
logger.debug user.login
logger.debug password
logger.debug user.password
logger.debug user.inspect
# return user
return user if user.password == password return user if user.password == password
return return
end end
def self.create_from_hash!(hash) def self.create_from_hash!(hash)
# logger.debug(hash.inspect)
# raise hash.to_yaml
# exit
url = '' url = ''
if hash['info']['urls'] then if hash['info']['urls'] then
url = hash['info']['urls']['Website'] || hash['info']['urls']['Twitter'] || '' url = hash['info']['urls']['Website'] || hash['info']['urls']['Twitter'] || ''
end end
# logger.debug(hash['info'].inspect)
# raise url.to_yaml
# exit
# logger.debug('aaaaaaaa')
roles = Role.where( :name => 'Customer' ) roles = Role.where( :name => 'Customer' )
create( create(
:login => hash['info']['nickname'] || hash['uid'], :login => hash['info']['nickname'] || hash['uid'],
@ -61,7 +47,6 @@ class User < ApplicationModel
user = User.find(user_id) user = User.find(user_id)
data = user.attributes data = user.attributes
# get linked accounts # get linked accounts
data['accounts'] = {} data['accounts'] = {}
authorizations = user.authorizations() || [] authorizations = user.authorizations() || []