Guest User

Untitled

a guest
Feb 21st, 2018
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. def create #This action is to make the rot13 key to give access to the survey application
  2. if params.has_key?("commit")
  3. formdata = params.fetch("organization")
  4. formdata["signupip"] = request.remote_ip
  5. formdata["access_key"] = formdata["name"].crypt("o"+formdata["signupip"])
  6. formdata["contact_areacode"] = formdata["contact_areacode"].gsub(/[^\d]/, '')
  7. formdata["contact_areacode"] = formdata["contact_areacode"].gsub(/[^\d]/, '')
  8. begin
  9. Organization.create(formdata)
  10. flash[:message] = "Organization created! Your access key is <strong>#{formdata["access_key"]}</strong>.<br />This key has also been emailed to you at: #{formdata["contact_email"]}</strong>."
  11. rescue => e
  12. #handle error... (e.message returns the error in a string)
  13. flash[:notice] = "<strong>There was an error while signing up your organization.</strong><br />Please try again or contact us for assistance."
  14. end
  15. else # Show form, etc.
  16. end
  17. end
Add Comment
Please, Sign In to add comment