http://web2py.com/books/default/chapter/29/09#Mail-and-Auth 

auth.messages.verify_email = 'Click on the link http://' + 
request.env.http_host + 
         URL(r=request,c='default',f='user',args=['verify_email']) + '/%(key)s 
to verify your email' 

auth.messages.reset_password = 'Click on the link http://' + 
request.env.http_host + 
URL(r=request,c='default',f='user',args=['reset_password']) + '/%(key)s to 
reset your password'

replace request.env.http_host with your own and voilĂ .



On Tuesday, December 4, 2012 4:07:36 PM UTC+1, Francisco Barretto wrote:
>
> Hi there!
>
> Trying to use email validation for new users and stuck with a problem. 
> Web2Py is running in its own container and listens localhost:8000. Apache 
> is dealing with incoming requests at ports 80 and 443, since I've got other 
> web applications and routes web2py requests to localhost:8000 as follows:
>
> <VirtualHost *:80>
>         ServerAdmin webmaster@localhost
>         DocumentRoot /var/www
>         <Directory />
>                 Options FollowSymLinks
>                 AllowOverride None
>         </Directory>
>         <Directory /var/www/>
>                 Options Indexes FollowSymLinks MultiViews
>                 AllowOverride None
>                 Order allow,deny
>                 allow from all
>                 AddHandler mod_python .py
>                 PythonHandler mod_python.publisher
>                 PythonDebug on
>         </Directory>
>         ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
>         <Directory "/usr/lib/cgi-bin">
>                 AllowOverride None
>                 Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
>                 Order allow,deny
>                 Allow from all
>         </Directory>
>         ErrorLog /var/log/apache2/error.log
>         # Possible values include: debug, info, notice, warn, error, crit,
>         # alert, emerg.
>         LogLevel warn
>         CustomLog /var/log/apache2/access.log combined
>     Alias /doc/ "/usr/share/doc/"
>     <Directory "/usr/share/doc/">
>         Options Indexes MultiViews FollowSymLinks
>         AllowOverride None
>         Order deny,allow
>         Deny from all
>         Allow from 127.0.0.0/255.0.0.0 ::1/128
>     </Directory>
>
> <VirtualHost *:80>
>         ServerAdmin webmaster@localhost
>         DocumentRoot /var/www
>         <Directory />
>                 Options FollowSymLinks
>                 AllowOverride None
>         </Directory>
>         <Directory /var/www/>
>                 Options Indexes FollowSymLinks MultiViews
>                 AllowOverride None
>                 Order allow,deny
>                 allow from all
>                 AddHandler mod_python .py
>                 PythonHandler mod_python.publisher
>                 PythonDebug on
>         </Directory>
>         ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
>         <Directory "/usr/lib/cgi-bin">
>                 AllowOverride None
>                 Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
>                 Order allow,deny
>                 Allow from all
>         </Directory>
>         ErrorLog /var/log/apache2/error.log
>         # Possible values include: debug, info, notice, warn, error, crit,
>         # alert, emerg.
>         LogLevel warn
>         CustomLog /var/log/apache2/access.log combined
>     Alias /doc/ "/usr/share/doc/"
>     <Directory "/usr/share/doc/">
>         Options Indexes MultiViews FollowSymLinks
>         AllowOverride None
>         Order deny,allow
>         Deny from all
>         Allow from 127.0.0.0/255.0.0.0 ::1/128
>     </Directory>
> Alias /web2py /home/www-data/web2py/applications
>    ### admin requires SSL
>    <LocationMatch "^/admin">
>      SSLRequireSSL
>    </LocationMatch>
>    ### appadmin requires SSL
>    <LocationMatch "^/welcome/appadmin/.*">
>      SSLRequireSSL
>    </LocationMatch>
>    ### serve static files directly
>    <LocationMatch "^/welcome/static/.*">
>      Order Allow,Deny
>      Allow from all
>    </LocationMatch>
>    ### proxy all the other requests
>    <Location "/welcome">
>      Order deny,allow
>      Allow from all
>      ProxyPass http://localhost:8000/welcome
>      ProxyPassReverse http://localhost:8000/
>    </Location>
>    LogFormat "%h %l %u %t %>s %b" common
>    CustomLog /var/log/apache2/access.log common
> </VirtualHost>
>
> <VirtualHost *:443>
>    SSLEngine On
>    SSLCertificateFile /etc/apache2/ssl/server.crt
>    SSLCertificateKeyFile /etc/apache2/ssl/server.key
>    <Location "/">
>      Order deny,allow
>      Allow from all
>      ProxyPass http://localhost:8000/
>      ProxyPassReverse http://localhost:8000/
>    </Location>
>    LogFormat "%h %l" common
>    CustomLog /var/log/apache2/access.log common
> </VirtualHost>
>
> So, the problem is Web2Py thinks it is running and receiving localhost 
> requests and therefore sends a localhost email validation link which is 
> really a mess, since the user will try to open this link at home and find a 
> non-existent url:
>
> Click on the link 
> http://localhost:8000/DNSAdmin/default/user/verify_email/12c362dc-ca0e-4699-87a0-997f819ba50d
>  to verify your email
>
> Any hints? Thanks!
>
>

-- 



Reply via email to