]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/accounts/terms_controller.rb
Remove account terms code unreachable for unregistered users
[rails.git] / app / controllers / accounts / terms_controller.rb
index 0513a031c96ad2cdb8ac84f7a91adb7095c45142..45e0cc239f4dcb465e3c50755a1fc111996c70d6 100644 (file)
@@ -20,46 +20,32 @@ module Accounts
       else
         @title = t ".title"
 
-        if current_user&.terms_agreed?
+        if current_user.terms_agreed?
           # Already agreed to terms, so just show settings
           redirect_to edit_account_path
-        elsif current_user.nil?
-          redirect_to login_path(:referer => request.fullpath)
         end
       end
     end
 
     def update
-      @title = t "users.new.title"
-
       if params[:decline] || !(params[:read_tou] && params[:read_ct])
-        if current_user
-          current_user.terms_seen = true
-
-          flash[:notice] = { :partial => "accounts/terms/terms_declined_flash" } if current_user.save
-
-          referer = safe_referer(params[:referer]) if params[:referer]
+        current_user.terms_seen = true
 
-          redirect_to referer || edit_account_path
-        elsif params[:decline]
-          redirect_to t("users.terms.declined"), :allow_other_host => true
-        else
-          redirect_to account_terms_path
-        end
-      elsif current_user
+        flash[:notice] = { :partial => "accounts/terms/terms_declined_flash" } if current_user.save
+      else
         unless current_user.terms_agreed?
           current_user.consider_pd = params[:user][:consider_pd]
           current_user.tou_agreed = Time.now.utc
           current_user.terms_agreed = Time.now.utc
           current_user.terms_seen = true
 
-          flash[:notice] = t "users.new.terms accepted" if current_user.save
+          flash[:notice] = t ".terms accepted" if current_user.save
         end
+      end
 
-        referer = safe_referer(params[:referer]) if params[:referer]
+      referer = safe_referer(params[:referer]) if params[:referer]
 
-        redirect_to referer || edit_account_path
-      end
+      redirect_to referer || edit_account_path
     end
   end
 end