add login database authentication check

change in memory authentication check to mongodb