Created
March 8, 2011 19:10
-
-
Save gmgent/860812 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def create | |
| respond_to do |format| | |
| format.xml { | |
| install = OnInstall.new do |i| | |
| i.ip_address = request.remote_ip | |
| i.mac_address = params[:mac_address] | |
| i.on_dvd_id = params[:on_dvd_id].to_i | |
| i.on_dvd_number = params[:on_dvd_number] | |
| i.on_dvd_set_id = params[:on_dvd_set_id].to_i | |
| i.on_game_id = params[:on_game_id].to_i | |
| end | |
| ts_param = params[:redacted] | |
| hash_to_match = params[:redacted] | |
| begin | |
| #FK validations | |
| test = OnDvd.find(install.on_dvd_id) | |
| test = OnDvdSet.find(install.on_dvd_set_id) | |
| test = OnGame.find(install.on_game_id) | |
| #validate md5 hash | |
| live_matcher = "redacted" | |
| digest = Digest::MD5.hexdigest(live_matcher) | |
| if digest.upcase == hash_to_match.upcase | |
| if install.save | |
| headers['location'] = on_install_path(install.id) | |
| render :nothing => true, :status => "201 Created" | |
| else | |
| render :xml => install.errors.to_xml, :status => "400 Bad Request" | |
| end | |
| else | |
| render :xml => "Your s param hash did not match the POST fields.", :status => "403 Forbidden" | |
| end | |
| rescue Exception => e | |
| render :xml => e.message, :status => "503 Server Error" | |
| end | |
| } | |
| format.html {if current_user == :false then redirect_to home_url else super end} | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment