Skip to content

Instantly share code, notes, and snippets.

@samchandra
Created December 18, 2010 13:21
Show Gist options
  • Save samchandra/746501 to your computer and use it in GitHub Desktop.
Save samchandra/746501 to your computer and use it in GitHub Desktop.
# read password file
password_array = CSV.parse(File.open(PASSWORD_FILE_PATH, "r"))
# find user
users = []
password_array.each do |e|
if (e[0] == (params[:login]['username']).downcase) && (e[1] == (params[:login]['password']).downcase)
users << e
end
end
# return user
users.first
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment