Fixed some problems with the user API and added test for temporary password code expiary.