Fix minor bugs.

Fixed minor bugs that were occuring in the platform: changed validation
in user model, moved form macros to a macros.php file and moved their
inclusion from the local to global start.