[#64] updated the method authenticate user - after consultation removed the nested ifs