Ok.. to answer my first question:

> Can anyone suggest a workaround for this issue?

<code>

    @expose()
    def login_action(self, previous_url = "/login", **kwargs):

      logged_in = False
      if (not identity.current.anonymous and
          identity.was_login_attempted() and
          not identity.get_identity_errors()):
            logged_in = True

      if not logged_in:
        # Refer them back to the login page with appropriate message
        return {
          "tg_template" : "templates.login",
          "message" : "User not recognised or password invalid",
          "previous_url" : previous_url
        }
      else:
        # Carry on to where they wanted to go in the first place
        redirect(previous_url, **kwargs)

</code>


On Mar 13, 4:52 pm, t o b e <[email protected]> wrote:
> Hi folks,
>
> I'm currently developing a company site using TG1.1b3 (going well so
> far.. cherrypy, sqlalchemy and genshi rock !!) and have found a few
> issues with identity that I was hoping you might have some ideas on.
>
> Briefly.. I log in to another system on the users behalf when they log
> into my TG site. This requires performing another action after login.
> The current recipe 
> here:http://docs.turbogears.org/1.0/IdentityRecipes#do-something-special-a...
> has the one annoying drawback that, if the user incorrectly enters
> their details, the redirect back to the previous_url effectively
> erases knowledge of the incorrect login and
> identity.was_login_attempted will always be false (as though you had
> come to the page for the first time).
>
> Can anyone suggest a workaround for this issue? It's a small thing but
> I do think it important to be able to tell the user that their details
> were incorrect.
>
> Another annoyance is that the thirdparty site I'm logging into (it's
> phpbb3, btw) requires plaintext passwords. Is there ever a way to
> recover these from identity ? This is less of a problem for me as I
> guess I can work around this by adding my own hashed login function to
> the phpbb3 codebase.
>
> Thanks in advance,
>
> --
> tobe
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to