X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/0c7c950149888777e186e2eb7525b37f340bc6f0..c486dd5532d2b826759becfad417670219ede19b:/app/controllers/users_controller.rb?ds=sidebyside diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 74ec5c0ec..3156497a4 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -60,6 +60,8 @@ class UsersController < ApplicationController session[:referer] end + parse_oauth_referer @referer + append_content_security_policy_directives( :form_action => %w[accounts.google.com *.facebook.com login.live.com github.com meta.wikimedia.org] ) @@ -69,7 +71,7 @@ class UsersController < ApplicationController # page, instead send them to the home page redirect_to @referer || { :controller => "site", :action => "index" } elsif params.key?(:auth_provider) && params.key?(:auth_uid) - @verified_email = params[:verified_email] + @email_hmac = params[:email_hmac] self.current_user = User.new(:email => params[:email], :display_name => params[:nickname], @@ -107,7 +109,7 @@ class UsersController < ApplicationController render :action => "new" else # Save the user record - save_new_user params[:verified_email] + save_new_user params[:email_hmac] end end end @@ -241,8 +243,8 @@ class UsersController < ApplicationController failed_login t("sessions.new.auth failure") end else - verified_email = UsersController.message_hmac(email) if email_verified && email - redirect_to :action => "new", :nickname => name, :email => email, :verified_email => verified_email, + email_hmac = UsersController.message_hmac(email) if email_verified && email + redirect_to :action => "new", :nickname => name, :email => email, :email_hmac => email_hmac, :auth_provider => provider, :auth_uid => uid end end @@ -260,7 +262,7 @@ class UsersController < ApplicationController def self.message_hmac(text) sha256 = Digest::SHA256.new - sha256 << Rails.application.key_generator.generate_key("openstreetmap/verified_email") + sha256 << Rails.application.key_generator.generate_key("openstreetmap/email_address") sha256 << text Base64.urlsafe_encode64(sha256.digest) end