How can I make this kind of redirect in Seaside?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How can I make this kind of redirect in Seaside?

Mariano Martinez Peck
Hi guys,

Ley's say I have a root component registered in /registration which takes care of user registration. Inside a callback of a button ('Register') I want to redirect to /reps (my real app prefix) which is associated to a different root task which renders the welcome/login window from which you enter to the app.

What I want is to "auto-login" after register. So I need to make a redirect from /registration to /reps but auto-getting a session for that root task etc. I guess the way to do this is to simulate getting a session and make the redirect  to /reps_s=... 

Any ideas?

Thanks in advance, 

--

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: How can I make this kind of redirect in Seaside?

Philippe Marschall
On Tue, Jul 18, 2017 at 4:02 PM, Mariano Martinez Peck
<[hidden email]> wrote:

> Hi guys,
>
> Ley's say I have a root component registered in /registration which takes
> care of user registration. Inside a callback of a button ('Register') I want
> to redirect to /reps (my real app prefix) which is associated to a different
> root task which renders the welcome/login window from which you enter to the
> app.
>
> What I want is to "auto-login" after register. So I need to make a redirect
> from /registration to /reps but auto-getting a session for that root task
> etc. I guess the way to do this is to simulate getting a session and make
> the redirect  to /reps_s=...
>
> Any ideas?

Maybe you can take some ideas from WARestfulComponentFilter >>
#startSessionWithRoot: you can use #rootComponent: switch the root
component.

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: How can I make this kind of redirect in Seaside?

Mariano Martinez Peck


On Tue, Jul 18, 2017 at 1:09 PM, Philippe Marschall <[hidden email]> wrote:
On Tue, Jul 18, 2017 at 4:02 PM, Mariano Martinez Peck
<[hidden email]> wrote:
> Hi guys,
>
> Ley's say I have a root component registered in /registration which takes
> care of user registration. Inside a callback of a button ('Register') I want
> to redirect to /reps (my real app prefix) which is associated to a different
> root task which renders the welcome/login window from which you enter to the
> app.
>
> What I want is to "auto-login" after register. So I need to make a redirect
> from /registration to /reps but auto-getting a session for that root task
> etc. I guess the way to do this is to simulate getting a session and make
> the redirect  to /reps_s=...
>
> Any ideas?

Maybe you can take some ideas from WARestfulComponentFilter >>
#startSessionWithRoot: you can use #rootComponent: switch the root
component.


Hi Philippe,

Thanks, that did work nicely. The only thing that took me some time to figure out is HOW to build the methods with the pragmas. There was no subclass of the filter as an example. I had to search lot in mailing lists until I come up with a working method example. I ended doing something like this:

userRegistration
<get>
<path: '/registration'>
self startSessionWithRoot: MyComponent new.

If we can add that into the class comment it would be cool.

Thanks!

--

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: How can I make this kind of redirect in Seaside?

Philippe Marschall
On Tue, Jul 18, 2017 at 9:01 PM, Mariano Martinez Peck
<[hidden email]> wrote:

>
>
> On Tue, Jul 18, 2017 at 1:09 PM, Philippe Marschall
> <[hidden email]> wrote:
>>
>> On Tue, Jul 18, 2017 at 4:02 PM, Mariano Martinez Peck
>> <[hidden email]> wrote:
>> > Hi guys,
>> >
>> > Ley's say I have a root component registered in /registration which
>> > takes
>> > care of user registration. Inside a callback of a button ('Register') I
>> > want
>> > to redirect to /reps (my real app prefix) which is associated to a
>> > different
>> > root task which renders the welcome/login window from which you enter to
>> > the
>> > app.
>> >
>> > What I want is to "auto-login" after register. So I need to make a
>> > redirect
>> > from /registration to /reps but auto-getting a session for that root
>> > task
>> > etc. I guess the way to do this is to simulate getting a session and
>> > make
>> > the redirect  to /reps_s=...
>> >
>> > Any ideas?
>>
>> Maybe you can take some ideas from WARestfulComponentFilter >>
>> #startSessionWithRoot: you can use #rootComponent: switch the root
>> component.
>>
>
> Hi Philippe,
>
> Thanks, that did work nicely. The only thing that took me some time to
> figure out is HOW to build the methods with the pragmas. There was no
> subclass of the filter as an example. I had to search lot in mailing lists
> until I come up with a working method example. I ended doing something like
> this:
>
> userRegistration
> <get>
> <path: '/registration'>
> self startSessionWithRoot: MyComponent new.
>
> If we can add that into the class comment it would be cool.

This is standard Seaside-REST for which quite some documentation is
available [1] [2]. The only thing outdated is the loading but it seems
as if you managed that part.

 [1] https://github.com/SeasideSt/Seaside/wiki/Seaside-REST
 [2] http://book.seaside.st/book/advanced/restful

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: How can I make this kind of redirect in Seaside?

Mariano Martinez Peck


On Thu, Jul 20, 2017 at 8:11 AM, Philippe Marschall <[hidden email]> wrote:
On Tue, Jul 18, 2017 at 9:01 PM, Mariano Martinez Peck
<[hidden email]> wrote:
>
>
> On Tue, Jul 18, 2017 at 1:09 PM, Philippe Marschall
> <[hidden email]> wrote:
>>
>> On Tue, Jul 18, 2017 at 4:02 PM, Mariano Martinez Peck
>> <[hidden email]> wrote:
>> > Hi guys,
>> >
>> > Ley's say I have a root component registered in /registration which
>> > takes
>> > care of user registration. Inside a callback of a button ('Register') I
>> > want
>> > to redirect to /reps (my real app prefix) which is associated to a
>> > different
>> > root task which renders the welcome/login window from which you enter to
>> > the
>> > app.
>> >
>> > What I want is to "auto-login" after register. So I need to make a
>> > redirect
>> > from /registration to /reps but auto-getting a session for that root
>> > task
>> > etc. I guess the way to do this is to simulate getting a session and
>> > make
>> > the redirect  to /reps_s=...
>> >
>> > Any ideas?
>>
>> Maybe you can take some ideas from WARestfulComponentFilter >>
>> #startSessionWithRoot: you can use #rootComponent: switch the root
>> component.
>>
>
> Hi Philippe,
>
> Thanks, that did work nicely. The only thing that took me some time to
> figure out is HOW to build the methods with the pragmas. There was no
> subclass of the filter as an example. I had to search lot in mailing lists
> until I come up with a working method example. I ended doing something like
> this:
>
> userRegistration
> <get>
> <path: '/registration'>
> self startSessionWithRoot: MyComponent new.
>
> If we can add that into the class comment it would be cool.

This is standard Seaside-REST for which quite some documentation is
available [1] [2]. The only thing outdated is the loading but it seems
as if you managed that part.

 [1] https://github.com/SeasideSt/Seaside/wiki/Seaside-REST
 [2] http://book.seaside.st/book/advanced/restful



Thanks Philippe I wasn't aware of that information. Very useful!

 
Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



--

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside