Ionic 3 Setting root page - ionic2

when I load my ionic application I check whether or not the user is authenticated or not. If they are I set the root page to the home page but if they are not I set the root page to the login page. My issue is when I am currently on another page so the url would look like this: http://localhost:8102/#/nav/n4/location-select
then I refresh the page my root page gets set back to the home page and I do not stay on the page I was currently on. Is there a way to make it so when I refresh the page I do not automatically go to the home page but stay on the current page I am on? Thanks for the help!
this.afAuth.authState.take(1).subscribe(auth => {
if (auth)
this.rootPage = "home";
else
this.rootPage = "LoginPage";
});

There's no way and it's not a good thing to happen. When you reload your page or livereload via saving some application changes it's like you've closed and opened the application again. Having it to start in the point you've stoped would cause some crashes and it's badfor developing.
The only thing that reloads at the same page is changing CSS, then it does a hot reload that doesn't changes the page, but show changings.

Related

Oracle-Apex: Dynamically redirecting from login button

The scenario
I have implemented social authentication similarly to described by Dimitri Gielisin hist post "Facebook, Google and Custom Authentication in the same Oracle APEX 18.1 app" (http://dgielis.blogspot.com/2018/06/facebook-google-and-custom.html)
The pertinent point is that there is a button which has the request 'APEX_AUTHENICATION=FACEBOOK' which logs the user in and also hard codes the page that the user is taken to.
It works great. (However if I have a login menu item which directs back to the same page - the user name isn't updated on the page.)
The Issue
Default behaviour is for apex to redirect users to the login page when they attempt to access a page which is not publicly available.  After logging in the user is taken to the page hard coded page in the button (except for modal dialogues which just produce an invalid session error). 
I'd love it if they could sign in and then continue to the page they need to go to. Is there some not extremely cumbersome ways of doing that? I thought of trying to saving the page number I want the user to go to into an application item and then having the button redirecting based on the application item- but while I was saving the page number the dynamic redirect in the button is not working...and I feel like I'm fighting the apex framework...
Is there a better way? If not can a button reference an item for the page number? I was trying &APP_ITEM. but that didn't seem to work...
(I"m using Apex 20.1)

Resubmit form error

I made a JSF web application. It was generated in netbeans ide.
To prevent pages being unresponsive I've set pages to auto-refresh in a set time interval.
I have a list page like this
List of records
And I can create a record like this
create a record
Say, I have set auto-refresh to every 30 seconds. I create a new record and return to list page. After 30 seconds it will give me this error: "Resubmit form? To refresh this page, your browser needs to repeat any actions you've already taken. For example, if you've already entered info into a form, your info will be resubmitted to the site".
This only happens if I access from another computer. From localhost it just redirects to list page without error popping up.
It seems like when I click to load create page, this action is remembered and when list page is refreshed it refreshes the create page.
I fixed it by redirecting to index after submitting.
FacesContext.getCurrentInstance().getExternalContext().redirect("../../faces/index.xhtml");

Facebook tab page load app doesn't pass parameter

I have an app in a facebook page tab that show some informations and this information must change for every user (ID_USER). I don't know how to load the correct data in the facebook app tab page. My app is a Django app. I've done this step:
1) create an app in my developers account (a page tab application) with this url https://www.exemple.com/ID_USER.
2) load the url https://www.facebook.com/dialog/pagetab?app_id=MY_APP_ID&redirect_uri=www.exemple.com/ID_USER
3) Select in the window the page to install the app
4) I go to the page and I found the app.
The problem is that the app is only for a user and I would like to load the right data for every facebook page the app is installed.
I've read about signed_request and app_data but I don't understand how to set app_data. Canyou help me please?
* EDIT *
The problem seems to be the django internationalization redirect from
https://www.example.com/ID_USER
to
https://www.example.com/en/ID_USER
in my network console I see
302 https://www.example.com/ID_USER (with 'signed_request')
200 https://www.example.com/en/ID_USER (without 'signed_request')
How can I solve this issue?

What is the simplest way to create a page tab on the latest version of fb?

All I want to do is create a few pages with sign up forms for our fans and customers on our business facebook page.
I created the new app, named it and went on to the basic settings. From what I can tell I just need to set up the "page tab" info. I Named the tab, put in the page tab url, secure page tab url and uploaded a tab image.
Then I wait for it to show up on our fb page. I refresh the page and for a few seconds it looks like something is being loaded in the list of tabs. But then it stops and the layout of default tabs (photos, likes, and events) are unchanged.
The tab should link to the app url which should load inside of an iframe which will have the html from our web server.
That's how I understand it anyways.
You must add manually the application on your page through this URL: http://www.facebook.com/dialog/pagetab?app_id=APP_ID&redirect_uri=https://www.facebook.com/
Remember to replace APP_ID first.

Facebook iframe app. it is possible refresh when user log out from other browser tab

I have an iframe application.
When a user and another page and log in to facebook site, the application page is reloaded by facebook.
But, I want to reload the page in the logout state also.
Here is the scenario:
A user enters my iframe application and authorizes my app and successfully enters my app.
While using my app, the user opens my app (or fb site) in another browser tab.
The user logs out from facebook site in the last browser tab.
When user logs out from facebook, I want to automatically reload my application page in the browser.
How can I do this?
Have a look at FB.Event.subscribe, I think you should be able to use it to reload the page when the user's session changes.
Add something like this to your FB.init:
FB.Event.subscribe("auth.sessionChange", handleSessionChange);
...and the handleSessionChange callback function would look something like this:
function handleSessionChange(response) {
if(!response.session || response.session.uid!="$user_id"){
window.location.reload();
}
}
Unfortunately, your options are limited as communication with an IFRAME is very constrained. This may help you:
http://www.dyn-web.com/tutorials/iframes/refs.php