How to force the user to see the login page on his first session on the app

My login page is in a ‘modal’. I would like to force the user to login on his first session on my app.

I am checking if the localStorage contains the variable “user”, which is written after login and only pop the modal if it is not there, but the user can escape from the modal with the hardware back button on Android…
I see there’s an issue here :

Any idea on how to do this ?


I found the solution in this issue report :

So the solution is the following :

 $ionicModal.fromTemplateUrl('templates/login.html', {
    scope: $scope,
    hardwareBackButtonClose: false
  }).then(function(modal) {
    $scope.modal = modal;
    $scope.isUser = sessionService.get("user") ? true : false;
    if( !$scope.isUser ) {