Add register, login and logout related codes.