Looks like it's going to auth.settings.logged_url, which should only happen 
if you call the auth.register() function when the user is already logged in 
-- is that happening anywhere?

Also, by default, if you get to the login page via the navbar link from 
another page, you will be redirected back to that page. If you get to the 
login page via a direct link (e.g., a bookmark), then you will get 
redirected to auth.settings.login_next, which in your case would default to 
URL('user', 'index') -- so you would want to change it to URL('school', 
'index').

Anthony

On Wednesday, September 5, 2012 8:44:00 AM UTC-4, Yebach wrote:
>
>
> 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=['
> vid....@algit.si <javascript:>'],
>           subject='web2py registration',
>           # If reply_to is omitted, then mail.settings.sender is used
>           reply_to='u...@example.com <javascript:>',
>           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='x...@gmail.com <javascript:>'
>     mail.settings.login='x...@gmail.com: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
>>>
>>

-- 



Reply via email to