I'm working on my first flex app that authenticates against a TG1 app,
and found this recipe in the documentation. I modified it to accept a
username/password, verify the password, and then log in the user. It
seems like the wrong way to go, but it works fine so far. But, I
haven't yet used groups/permissions to modify what the user sees in
Flex.
<code>
@expose("json")
def login_user(self, user_name=None, password=None):
if identity.current.user != None:
return dict(retcode=0, status="Already logged in as
%s" % identity.current.user_name)
user = model.User.by_user_name(user_name)
if user and password and user.password ==
identity.encrypt_password(password):
"""Associate given user with current visit &
identity."""
visit_key = visit.current().key
user_identity = identity.current_provider.load_identity
(visit_key)
identity.set_current_identity(user_identity)
return dict(retcode=0, status="Successfully logged in
as %s" % user.user_name)
return dict(retcode=1, status="Incorrect user/password.")
</code>
Is this a valid way to handle authentication? What's the _right_ way
to do it?
~Sean
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---