Jeff-Lewis / vosao

Automatically exported from code.google.com/p/vosao
GNU Lesser General Public License v2.1
0 stars 0 forks source link

SiteUser is redirected to /cms/ after login #556

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
One thing I've just noticed is that a SiteUser, after login, is no longer 
redirected to the root but instead to /cms/, same as Admin and User.

Can you confirm that happening, or is it maybe a problem with my configuration?

Original issue reported on code.google.com by theb...@emanueleziglioli.it on 10 Feb 2012 at 1:37

GoogleCodeExporter commented 9 years ago
My login form does this:

              Vosao.jsonrpc.loginFrontService.login(function (r, e) {
                    if (Vosao.serviceFailed(e)) return;
                    if (r.result == 'success') {
                        $('#login-messages').html('<span style="color:green">Success. Logging in...</span>');
                        document.location.href = r.message;
                    }

I don't know what it used to be for a SiteUser but currently LoginServiceImpl 
returns a value '/cms/'.
Maybe that hasn't changed, what's changed is what happens after that.
I'm getting an error:

stack   TypeError: Cannot call method 'getLoggedIn' of undefined
    at http://172.20.104.73:8888/cms/main.min.js:11:353022
    at JSONRpcClient.readyCB (http://172.20.104.73:8888/cms/main.min.js:11:239401)
    at Object.cb (http://172.20.104.73:8888/cms/main.min.js:11:1743)
    at http://172.20.104.73:8888/cms/main.min.js:11:231151
arguments   getLoggedIn,
type    non_object_property_call
message Cannot call method 'getLoggedIn' of undefined
name    TypeError

Ok, so what I'm missing is these two lines in my script:

        Vosao.app.loggedIn = true;
          Vosao.app.trigger('login');

the problem in my case is that Vosao.app is not defined.
So, ok, there's no problem if I go to /cms/ when I'm not logged in, the login 
works.
It's when I use a form embedded in the main page that that doesn't work.
Perhaps I'm missing some initialization. I know a dependency on backbone was 
added....

Original comment by theb...@emanueleziglioli.it on 11 Feb 2012 at 12:50

GoogleCodeExporter commented 9 years ago
The same problem was solved by replacing the document.location.href = 
r.message; on
document.location.href = 'any URL';

Original comment by SlynkoNi...@gmail.com on 12 Feb 2012 at 8:21

GoogleCodeExporter commented 9 years ago
yep, that's what I did at the end :-) thx

Original comment by theb...@emanueleziglioli.it on 12 Feb 2012 at 8:40

GoogleCodeExporter commented 9 years ago

Original comment by kinyelo@gmail.com on 12 Feb 2012 at 8:51

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r1150.

Original comment by kinyelo@gmail.com on 12 Feb 2012 at 8:52