Update user authentication check
Fix mail encoding