What I want to ask is, when a user visits the controller, then valid_user? plug function is triggered. That function is defined in the same controller, so is it a good idea to do that or should i have moved that code to action/2?
Another option would be to assign current_user into the connection during your valid_user? call. assign(conn, :current_user, user)
If you need access to the current_user you get it by conn.assigns.current_user
Keeps from having to create a custom action in your controllers which might not be immediately obvious. That pattern can also start to get cumbersome if you need to pass other current values. E.g., current_account when accounts have multiple users.