How should I alter forms shown in a block? I want to alter the login form to display only the @username and @password inputs. 


Is it mandatory to write another module to overwrite the user module? Can it be done from  my PHP block by using these 2 variables? If yes, how can I find the name of the variables?
What is the Drupal recommended way for doing this?
There are two ways to display only some fields:


Get the original form, and remove unneeded fields. This can be done 2 ways, in hook_form_alter() or by calling drupal_get_form() and working on outputted array. This way is risky - save handler might be unable to save if some fields it expects are missing.
Create your own form, with your own inputs, validators and save handlers. Copy strings from form you are copying to keep using any translations already available. This is safer, but requires a bit more work.


In theory you can handle form in a block with php filter. I would not recommend it. It's way more manageable to keep code in files. And if you have APC, it's also way faster. Thus, modules are the way to go.