implemented log in functionality in model