add template and user auth function
merge