My Bad. Please try this. replace the login() function
def login(): return dict(form=t2.login())
with
if t2.logged_in:
cache.ram('client:%s' % t2.person_id, lambda:request.client, 0)
### store client ip in cache
def login():
if request.vars.email:
client=cache.ram('client:%s' % request.vars.email,
lambda:request.client, 300) ### retrieve client email
if client and client!=request.client: ### if no match, force
logout
session.flash="sorry, somebody else is currently logged
in as you"
redirect(URL(r=request))
return dict(form=t2.login())
On Feb 13, 1:26 am, drayco <[email protected]> wrote:
> Yes, I tested with two diferrent and two diferrent IP addresses.
>
> I use share hosting with apache and wsgi in webfaction.
>
> On 12 feb, 23:05, mdipierro <[email protected]> wrote:
>
>
>
>
>
> > Did you test logging from two different machines? Different IP
> > addresses?
>
> > Massimo
>
> > On Feb 12, 8:15 pm, drayco <[email protected]> wrote:
>
> > > I tested it and the problem is the same.
>
> > > Do you have other suggestion?
>
> > > On 12 feb, 15:37, drayco <[email protected]> wrote:
>
> > > > Thanks in advanced. I will try to fix that this afternoon.
>
> > > > On 12 feb, 14:33, mdipierro <[email protected]> wrote:
>
> > > > > Yes you can but this is not one line change. Assuming you have a
> > > > > single server (not mutliple servers behind a NAT), the easy way is to
> > > > > replace the register function in controllers/default.py with the
> > > > > following code:
>
> > > > > if t2.logged_in: cache.ram('client:%s' % t2.person_id, lambda:
> > > > > request.client, 0) ### store client ip in cache
>
> > > > > def register():
> > > > > form=t2.register
> > > > > (verification=settings.email_verification,sender=settings.email_sender)
> > > > > if t2.logged_in:
> > > > > client=cache.ram('client:%s' % t2.person_id, lambda:
> > > > > request.client, 300) ### retrieve client ip
> > > > > if client and client!=request.client: ### if no match, force
> > > > > logout
> > > > > t2.messages.logged_out="sorry, somebody else is currently
> > > > > logged in as you"
> > > > > t2.logout(next='login')
> > > > > return dict(form=form)
>
> > > > > On Feb 12, 2:00 pm, drayco <[email protected]> wrote:
>
> > > > > > I have many users with diferrents kinds of rights and they gave
> > > > > > their
> > > > > > passwords and user name to others people. The system allow to the
> > > > > > people enter to the application with the same user at the same time.
>
> > > > > > I now that because the people told me that they worked with the same
> > > > > > user, in the same time and in the same place but with diferrents
> > > > > > machines and in this moment i have a lot of problems with that.
>
> > > > > > And i don't want that this happend.
>
> > > > > > What can i do?
>
> > > > > > On Feb 12, 1:29 pm, mdipierro <[email protected]> wrote:
>
> > > > > > > I do not understand. Can you make an example?
>
> > > > > > > On Feb 12, 12:52 pm, drayco <[email protected]> wrote:
>
> > > > > > > > is it possible that int3Version 0.4 (2009-01-07 09:01:19) and
> > > > > > > > web2py
> > > > > > > > 1.55.2 diferent person with the same user can logg in?
>
> > > > > > > > And, if it is possible, how can i fix that?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---