title: Injecting data into Phoenix's Action params
body: <p>I'm trying to write some plugs to reduce amount of unneeded code in project and I would love to take some session data and put it into _params in controller's actions. But I have no idea how to do it. I came across the functon assign/3 but as far as i know it assigns data to be used in templates.</p>
  
  <pre><code>def logged(conn, _opts) do
      case get_session(conn, :login) do
        nil -&gt; conn
          |&gt; Phoenix.Controller.put_flash(:error, "Musisz być zalogowany")
          |&gt; Phoenix.Controller.redirect( to: "/")
          |&gt; Plug.Conn.halt
        login -&gt; #here
      end
    end
  </code></pre>
  
  <p>And i want to be able to do:</p>
  
  <pre><code>def someaction(conn, %{"login" =&gt; login}) do
    #do something with login
  end
  </code></pre>