refactor login funtion
add new_post method for publishing blog