auth/plugin.rb in discourse_dev-0.1.0 vs auth/plugin.rb in discourse_dev-0.2.0

- old
+ new

@@ -34,11 +34,11 @@ return unless is_allowed? if (env['REQUEST_METHOD'] == 'POST') && (request.params['uid']) data = request.params.slice(*FIELDS) r = Rack::Response.new - r.set_cookie(COOKIE, {value: data.to_json, path: "/", expires: 1.month.from_now}) + r.set_cookie(COOKIE, { value: data.to_json, path: "/", expires: 1.month.from_now }) uri = URI.parse(callback_path) uri.query = URI.encode_www_form(data) r.redirect(uri) @@ -59,11 +59,11 @@ raw_defaults = request.cookies[COOKIE] || "{}" defaults = JSON.parse(raw_defaults) rescue {} defaults["uid"] = SecureRandom.hex(8) unless defaults["uid"].present? defaults["email_verified"] = "true" unless defaults["email_verified"].present? - OmniAuth::Form.build(:title => "Fake Authentication Provider") do + OmniAuth::Form.build(title: "Fake Authentication Provider") do html "\n<input type='hidden' name='authenticity_token' value='#{token}'/>" FIELDS.each do |f| label_field(f, f) if f == "email_verified" @@ -126,11 +126,10 @@ end end auth_provider authenticator: DevelopmentAuthenticator.new - ### DiscourseConnect after_initialize do module ::DevelopmentAuth class Engine < ::Rails::Engine engine_name PLUGIN_NAME @@ -189,10 +188,10 @@ @advanced_fields = ADVANCED_FIELDS @bools = BOOLS append_view_path(File.expand_path("../app/views", __FILE__)) render template: "fake_discourse_connect/form", layout: false end - end + end DevelopmentAuth::Engine.routes.draw do get "/fake-discourse-connect" => "fake_discourse_connect#auth" post "/fake-discourse-connect" => "fake_discourse_connect#auth" end