basicly finished login func