rewrote login checkUser fn. Workinrking