Friday, 12 May 2017

url no complete after redirec on iphone

I have a web application developed with nodejs and angularjs. Initially it asks for authentication and after authentication it redirects me to a url where the user is passed as a parameter of the url. The application works correctly, but in the iphone does not arrive the information of the user that was authenticated, the same happens to me in IE8.

This is my backend code:

//redirect after login

static post(req: Request, res: Response) {
    res.redirect(`/_ui#/home/${req.user.tenant}`);
    res.end();
}

This is my frontend code

//angular module

export default angular.module("ml-trainer", ['ngRoute', 'ngFileUpload', 'ipCookie', 'ui.bootstrap.datetimepicker', 'ngDialog', 'checklist-model', 'nvd3', 'smart-table'])

// routes

.config(function($routeProvider, $locationProvider) {
    $routeProvider
        .when('/home/:tenant', {template: '<home></home>'})
})

// factory

.factory("tenant", function ($routeParams, $route, ipCookie, $location) {

    let tenant = {};
    let tenantName = $location.url().split("/");

    if(!ipCookie('tenant'))
    {
        // set selected tenant if a tenant param is passed
        if (tenantName[tenantName.length-1]) {
            tenant.id = tenantName[tenantName.length-1];
        }
        ipCookie('tenant', tenant, {expires: 7, expirationUnit: 'days'});
    }
    else
    {
        tenant.id=ipCookie('tenant').id;
    }

    return tenant;
})

In firefox, chrome, opera,android,.... the system ok. after login, redirect to: "https://example.com/_ui/#/home/tenantname" and get "tenantname" as tenant. But in ipone or IE, after redirect on browser I only receive "https://example.com/_ui" no more



via maikelm

No comments:

Post a Comment