function login (username, password) {
  return dispatch => {
    dispatch(loginRequest())
    return BackendFactory().login({
      username: username,
      password: password
    })

      .then(function (json) {
        return saveSessionToken(json)
          .then(function () {
            dispatch(loginSuccess(json))
            // navigate to Tabbar
            Actions.Tabbar()
            dispatch(logoutState())
          })
      })
      .catch((error) => {
        dispatch(loginFailure(error))
      })
  }
}
## Login
@param {string} username - user's name
@param {string} password - user's password

After calling Backend, if response is good, save the json
which is the currentUser which contains the sessionToken

If successful, set the state to logout
otherwise, dispatch a failure