my view user.html
<div class="web2py_user_form" id="web2py_user_form">
<h2>{{=T( request.args(0).replace('_',' ').capitalize() )}}</h2>
{{=form}}
{{if request.args(0)=='login':}}
{{if not 'register' in auth.settings.actions_disabled:}}
<div class="flash_1" id="flash_1">{{=response.flash or ''}}</div>
<br /> <a href="{{=URL(args='register')}}">{{=T('Register')}}</a>
{{pass}}
{{if not 'request_reset_password' in auth.settings.actions_disabled:}} <br
/>
<a href="{{=URL(args='request_reset_password')}}">{{=T('Lost
Password')}}</a>
{{pass}}
{{pass}}
<div id="logo_algit">
<a href="http://www.algit.eu" target="_blank"><img
src="{{=URL(request.application,'static','images/algit.gif')}}"
alt="Algit.eu" />
</a>
</div>
my model user.py
from gluon.tools import Auth
import urllib
if (request.controller=='user' or request.controller=='school' or
request.controller=='timetable' and request.cookies.has_key('mycookie')):
response.generic_patterns = ['*'] if request.is_local else []
database = request.cookies['mycookie'].value
baza = DAL('postgres://postgres:postgres@localhost/' + database,
migrate=True)
from gluon.tools import Mail
auth = Auth(baza, controller='user')
auth.settings.logout_next = URL('school','index',
vars=dict(school=database))
auth.settings.registration_requires_approval = True
auth.settings.register_onaccept=lambda form:
mail.send(to=['[email protected]'],
subject='web2py registration',
# If reply_to is omitted, then mail.settings.sender is used
reply_to='[email protected]',
message='Kreiral se je nov uporabnik, ki ga je potrebno
potrditi')
auth.settings.expiration = 3600
auth.define_tables()
mail=Mail()
auth.settings.mailer=mail
mail.settings.server='smtp.gmail.com:587'
mail.settings.sender='[email protected]'
mail.settings.login='[email protected]:xxxx'
auth.messages.registration_pending = u'Registracija je v postopku
odobritve. Ko bo vaš račun potrjen boste prejeli e-mail.'
auth.messages.invalid_login = 'Nepravilno geslo'
auth.messages.invalid_user = 'Uporabnik ne obstaja'
## configure auth policy
## if you need to use OpenID, Facebook, MySpace, Twitter, Linkedin, etc.
## register with janrain.com, write your domain:api_key in
private/janrain.key
from gluon.contrib.login_methods.rpx_account import use_janrain
use_janrain(auth,filename='private/janrain.key')
and my controler user.py
def user():
form = auth()
#auth.settings.controller="user"
return dict(form=form)
On Wednesday, September 5, 2012 2:40:09 PM UTC+2, Anthony wrote:
>
> First suggestion -- post your code. :-)
>
> On Wednesday, September 5, 2012 8:15:40 AM UTC-4, Yebach wrote:
>>
>> Hello
>>
>> My login function doesn't work. After I try to login i am redirected to
>> user/user/profile instead back to my main page /school/index.html
>> Register works, everything
>> Also, if I login and enter the url where I should be redirected again I
>> am redirected to /user/user/profile
>>
>> any suggestion??
>>
>> Thank you
>>
>
--