class QrcodesController < ApplicationController
  skip_before_filter :authenticate_user!
  
  ALLOWED_PATTERN = /^[a-zA-Z0-9\:\/\-\?\=]{1,255}$/
  
  def show
    data = URI.decode(params[:data])

    raise "Invalid data" unless data.match(ALLOWED_PATTERN)
  
    png_data = QREncoder.encode(data, :correction => :high).
      png(:pixels_per_module => 6, :margin => 1).
      to_blob
    
    send_data png_data,
      :type => 'image/png',
      :disposition => 'inline',
      :filename => "#{params[:filename] || data}.png"
  end
end

class QrcodesController < ApplicationController
  skip_before_filter :authenticate_user!
  
  ALLOWED_PATTERN = /^[a-zA-Z0-9\:\/\-\?\=]{1,255}$/
  
  def show
    data = params[:data]

    raise "Invalid data" unless data.match(ALLOWED_PATTERN)
  
    png_data = QREncoder.encode(data, :correction => :high).
      png(:pixels_per_module => 6, :margin => 1).
      to_blob
    
    send_data png_data,
      :type => 'image/png',
      :disposition => 'inline',
      :filename => "#{params[:filename] || data}.png"
  end
end

Revert "Fixed problem with Google Authenticator / QR Code"
Revert "Fixed problem with Google Authenticator / QR Code"

This reverts commit dbf8989378e881cac489f6d355f021cdb6f60113.
