Military: Maldives president resigns amid protests