Clickable link with key

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

Clickable link with key

Maarten Mostert
Hi,

I want to send an e-mail to endusers with a clickable link to confirm their email address something like:

https://stakepoint.com/SignUp/3223322331838388188338

But where do I start to make a Sioux / AppeX responder for this ?


Maarten MOSTERT

 

 

28 Av Alphonse Denis
83400 Hyères, France
+33 676411296 

 







_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Clickable link with key

Reinout Heeck-3
On 7/18/2015 12:02 PM, Maarten Mostert wrote:
Hi,

I want to send an e-mail to endusers with a clickable link to confirm their email address something like:

https://stakepoint.com/SignUp/3223322331838388188338

But where do I start to make a Sioux / AppeX responder for this ?



You will need a mail (SMTP) server somewhere that will send emails on your application's behalf.

Your responder can then instantiate an SMTP client and send the email.


An SMTP client can be found in the Cincom package 'SMTP'.

Instantiate a mail client with something like

mailClient

    ^(Net.SMTPClient new)
        hostName: self mailServer;
        username: self mailServerUser;
        useAuthentication: false;
        yourself.

Create the message and have the mailClient send it, here's a snippet from our build system:


sendEmailTo: recipiant subject: subject text: text html: html setup: aBlock saveAs: filename

    | msg ws htmlMsg relMsg |
    msg := Net.MailMessage new.
    msg subject: subject.
    "new mailserver doesnot like the old from... Now using unexisting address"
    msg from: (self emailAddressForStoreUser: 'PackageBot').
    msg to: recipiant.
    msg setAddressesAt: 'return-path' to: (self emailAddressForStoreUser: 'root').
    msg date: Timestamp now.
    relMsg := Net.MimeEntity new.
    relMsg contentType: 'multipart/alternative'.
    htmlMsg := Net.MimeEntity newTextPlain.
    htmlMsg contents: text.
    relMsg addPart: htmlMsg.
    htmlMsg := Net.MimeEntity newTextHTML.
    htmlMsg contents: html.
    relMsg addPart: htmlMsg.
    msg addPart: relMsg.
    aBlock value: msg.
    filename
        ifNotNil:
            [:fn |
            ws := fn asFilename writeStream.
            [msg writeOn: ws] ensure: [ws close]].
    self mailClient send: msg.


I notice the temps above are horribly named, but I'm sure you can cope with that :-)

HTH,

Reinout
-------



Maarten MOSTERT

 

 

28 Av Alphonse Denis
83400 Hyères, France
+33 676411296 

 








_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Clickable link with key

jtuchel
Hi Maarten,

I don't have an answer for you, but I needed something like this for Kontolino.de .

In Seaside, we wanted to do something similar and found the numeric part to be a bit more work than we found is worth. You usually register named handlers with your web servers, and if that name is "random", this makes things a bit more complicated. So we changed the URL to something like this:

https://stakepoint.com/SignUp?cust=3223322331838388188338

That way, we only register one handler named SignUp and this extracts the workload from the URL parameters.
I know this was a lot easier to solve in Seaside than registering a handler for "all sub-urls".

Not exactly a detailed answer to your question, but I hope it adds a piece to your mosaic.

Joachim



Am 20.07.15 um 12:21 schrieb Reinout Heeck:
On 7/18/2015 12:02 PM, Maarten Mostert wrote:
Hi,

I want to send an e-mail to endusers with a clickable link to confirm their email address something like:

https://stakepoint.com/SignUp/3223322331838388188338

But where do I start to make a Sioux / AppeX responder for this ?



You will need a mail (SMTP) server somewhere that will send emails on your application's behalf.

Your responder can then instantiate an SMTP client and send the email.


An SMTP client can be found in the Cincom package 'SMTP'.

Instantiate a mail client with something like

mailClient

    ^(Net.SMTPClient new)
        hostName: self mailServer;
        username: self mailServerUser;
        useAuthentication: false;
        yourself.

Create the message and have the mailClient send it, here's a snippet from our build system:


sendEmailTo: recipiant subject: subject text: text html: html setup: aBlock saveAs: filename

    | msg ws htmlMsg relMsg |
    msg := Net.MailMessage new.
    msg subject: subject.
    "new mailserver doesnot like the old from... Now using unexisting address"
    msg from: (self emailAddressForStoreUser: 'PackageBot').
    msg to: recipiant.
    msg setAddressesAt: 'return-path' to: (self emailAddressForStoreUser: 'root').
    msg date: Timestamp now.
    relMsg := Net.MimeEntity new.
    relMsg contentType: 'multipart/alternative'.
    htmlMsg := Net.MimeEntity newTextPlain.
    htmlMsg contents: text.
    relMsg addPart: htmlMsg.
    htmlMsg := Net.MimeEntity newTextHTML.
    htmlMsg contents: html.
    relMsg addPart: htmlMsg.
    msg addPart: relMsg.
    aBlock value: msg.
    filename
        ifNotNil:
            [:fn |
            ws := fn asFilename writeStream.
            [msg writeOn: ws] ensure: [ws close]].
    self mailClient send: msg.


I notice the temps above are horribly named, but I'm sure you can cope with that :-)

HTH,

Reinout
-------



Maarten MOSTERT

 

 

28 Av Alphonse Denis
83400 Hyères, France
+33 676411296 

 








_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


-- 
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel          [hidden email]
Fliederweg 1                         http://www.objektfabrik.de
D-71640 Ludwigsburg                  http://joachimtuchel.wordpress.com
Telefon: +49 7141 56 10 86 0         Fax: +49 7141 56 10 86 1


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Clickable link with key

Deyan Yanchev
In reply to this post by Maarten Mostert
Hi Maarten,

I would start with:

server := (SiouX.Server id: 'SignUp')
        addResponder: (responder := SiouX.SignUpResponder new);
        yourself.
responder path: '/SignUp/'.
listener := server listenOn: 8888 for: SiouX.HttpsConnection.
server start.

SiouX.SignUpResponder contains the following method:

executeRequest: httpRequest connection: connection

        httpRequest url tail = '3223322331838388188338'
                ifTrue:
                        [httpResponse := (SiouX.HttpResponse new)
                                                contentType: 'text/plain';
                                                contents: 'Success!';
                                                code: 200.
                        ^httpResponse].
        ^nil

Example is using VW 7.10.1.

Thanks, Deyan
Reply | Threaded
Open this post in threaded view
|

Re: Clickable link with key

Maarten Mostert

 

That was a good tip, and it now works.

 

What I do is make a bos stream of an array with the email and the date.

 

Then I crypt that and then I translate it into a aBase64URL string (almost the same as Base64).

 

I need to add something to make a difference with embedded references so I add check to my URL.

 

I then subclass the following method which gives me back the email and the date before redirecting the browser with the right answer.

 

 

 

executeRequestFor: aRequestContext

 

            | anURIstr anIndex stream aByteArray str str1 str2 bos email date thisBytes |

            anURIstr := aRequestContext request url asString.

            anIndex := anURIstr findString: '/SignUp/check' startingAt: 1.

            anIndex = 0

                       ifTrue: [^self class dispatchRequest: aRequestContext]

                       ifFalse:

                                   [str := anURIstr copyFrom: 14 to: anURIstr size.

                                   thisBytes := ByteArray fromBase64URLString: str.

                                   aByteArray := Crypter new decryptByteArray: thisBytes.

                                   stream := ReadStream on: aByteArray asByteArray.

                                   bos := BinaryObjectStorage onOld: stream.

                                   email := bos next.

                                   date := Date fromDays: bos next.

                                   bos close.

                                   super halt.

                                   ^(aRequestContext response)

                                               contentType: 'text/html';

                                               contents: '<!DOCTYPE HTML>

<html lang="en-US">

   <head>

       <meta charset="UTF-8">

       <meta http-equiv="refresh" content="1;url=https://stakepoint.com/">

       <script type="text/javascript">

          window.location.href = "https://stakepoint.com/"

       </script>

       <title>Page Redirection</title>

   </head>

</html>';

                                               yourself]

 

 

 

 

In my AppeX application class I subclassed

> "Deyan Yanchev" <[hidden email]> |

> Hi Maarten,


>
> I would start with:
>
> server := (SiouX.Server id: 'SignUp')
> addResponder: (responder := SiouX.SignUpResponder new);
> yourself.
> responder path: '/SignUp/'.
> listener := server listenOn: 8888 for: SiouX.HttpsConnection.
> server start.
>
> SiouX.SignUpResponder contains the following method:
>
> executeRequest: httpRequest connection: connection
>
> httpRequest url tail = '3223322331838388188338'
> ifTrue:
> [httpResponse := (SiouX.HttpResponse new)
> contentType: 'text/plain';
> contents: 'Success!';
> code: 200.
> ^httpResponse].
> ^nil
>
> Example is using VW 7.10.1.
>
> Thanks, Deyan
>
>
>
> --
> View this message in context:
> http://forum.world.st/Clickable-link-with-key-tp4838047p4838850.html
> Sent from the VisualWorks mailing list archive at Nabble.com.
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc