add register login middleware