fix login required and handling next page