refactoring post registration method

moving error messages into a hash inside of a method