Skip to content

Commit

Permalink
adjusted callsign lookups to be case insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismatthieu committed May 30, 2011
1 parent 0ac7c1a commit c11d3f7
Show file tree
Hide file tree
Showing 11 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion app/controllers/accounts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def login

if @u and @p.user.is_admin
# @u = User.find_by_login(params[:login])
@u = User.find(:first, :conditions => ['login = UPPER(?)', params[:login].upcase])
@u = User.find(:first, :conditions => ['login ILIKE ?', params[:login]])

flash[:notice] = "Hello #{@u.f rescue ''}"
# cookies[:auth_token] = {:expires => Time.now-1.day, :value => "" }
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/aprs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def callsign

#@user = User.find_by_login(@callsign)
# @user = User.find(:first, :conditions => ['login = ?', @callsign])
@user = User.find(:first, :conditions => ['login = UPPER(?)', @callsign.upcase])
@user = User.find(:first, :conditions => ['login ILIKE ?)', @callsign])


# if @user
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/blogs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def callsign

#@user = User.find_by_login(@callsign)
# @userx = User.find(:first, :conditions => ['login = ?', @callsign])
@userx = User.find(:first, :conditions => ['login = UPPER(?)', @callsign.upcase])
@userx = User.find(:first, :conditions => ['login ILIKE ?)', @callsign])


if @userx
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/contacts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def graph

#@user = User.find_by_login(@callsign)
# @userx = User.find(:first, :conditions => ['login = ?', @callsign])
@userx = User.find(:first, :conditions => ['login = UPPER(?)', @callsign.upcase])
@userx = User.find(:first, :conditions => ['login ILIKE ?)', @callsign])


if @userx
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/home_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,8 @@ def callsign
else

# @userx = User.find_by_login(@callsign)
@userx = User.find(:first, :conditions => ['login = UPPER(?)', @callsign.upcase])

@userx = User.find(:first, :conditions => ['login ILIKE ?)', @callsign])
# LOCALHOST use LIKE for mysql

@callelements = Array.new
if @userx
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/lists_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def callsign

# @user = User.find_by_login(@callsign)
# @userx = User.find(:first, :conditions => ['login = ?', @callsign])
@userx = User.find(:first, :conditions => ['login = UPPER(?)', @callsign.upcase])
@userx = User.find(:first, :conditions => ['login ILIKE ?)', @callsign])


if @userx
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/photos_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ def callsign

#@user = User.find_by_login(@callsign)
# @userx = User.find(:first, :conditions => ['login = ?', @callsign])
@userx = User.find(:first, :conditions => ['login = UPPER(?)', @callsign.upcase])

@userx = User.find(:first, :conditions => ['login ILIKE ?)', @callsign])

if @userx

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/profiles_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def callsign

#@user = User.find_by_login(@callsign)
# @user = User.find(:first, :conditions => ['login = ?', @callsign])
@user = User.find(:first, :conditions => ['login = UPPER(?)', @callsign.upcase])
@user = User.find(:first, :conditions => ['login ILIKE ?)', @callsign])


if @user
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/statuses_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def callsign

#@user = User.find_by_login(@callsign)
# @userx = User.find(:first, :conditions => ['login = ?', @callsign])
@userx = User.find(:first, :conditions => ['login = UPPER(?)', @callsign.upcase])
@userx = User.find(:first, :conditions => ['login ILIKE ?)', @callsign])


if @userx
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/timeline_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def callsign

#@user = User.find_by_login(@callsign)
# @user = User.find(:first, :conditions => ['login = ?', @callsign])
@user = User.find(:first, :conditions => ['login = UPPER(?)', @callsign.upcase])
@user = User.find(:first, :conditions => ['login ILIKE ?)', @callsign])


if @user
Expand Down
2 changes: 1 addition & 1 deletion app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def can_mail? user
# Returns the user or nil.
def self.authenticate(login, password)
# u = find_by_login(login) # need to get the salt
u = User.find(:first, :conditions => ['login = UPPER(?)', login.upcase])
u = User.find(:first, :conditions => ['login ILIKE ?)', @callsign])

u && u.authenticated?(password) ? u : nil
end
Expand Down

0 comments on commit c11d3f7

Please sign in to comment.