Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7903675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:48:29+00:00 2026-06-03T09:48:29+00:00

i am using custom user accounts for one of my projects and am using

  • 0

i am using custom user accounts for one of my projects and am using the User model and authentication provided by webapp2. Everything runs perfect but i am stuck at the part where authentication is not successful.

For Example:

#imports
from webapp2_extras.appengine.auth.models import User

class LoginHandler(SomeBaseRequestHandler):
  def get(self):
  '''self code goes in here'''

  def post(self):
    auth_id = 'authentication:id'
    password = 'somepassword'

    user = User.get_by_auth_password(authid, password)
    if user:
      # code to set a session and redirect to homepage
    else:
      # append error list and render a template

I am able to login the user however the problem arises if a user provides a wrong user name or password. if the user provides any of the wrong credentials it raises a server side error.

Traceback (most recent call last):
File "/opt/google_appengine_1.6.4/lib/webapp2/webapp2.py", line 1536, in __call__
rv = self.handle_exception(request, response, e)
File "/opt/google_appengine_1.6.4/lib/webapp2/webapp2.py", line 1530, in __call__
rv = self.router.dispatch(request, response)
File "/opt/google_appengine_1.6.4/lib/webapp2/webapp2.py", line 1278, in default_dispatcher
return route.handler_adapter(request, response)
File "/opt/google_appengine_1.6.4/lib/webapp2/webapp2.py", line 1102, in __call__
return handler.dispatch()
File "/home/tigerstyle/orbit/orbit/orbit/handlers.py", line 36, in dispatch
webapp2.RequestHandler.dispatch(self)
File "/opt/google_appengine_1.6.4/lib/webapp2/webapp2.py", line 572, in dispatch
return self.handle_exception(e, self.app.debug)
File "/opt/google_appengine_1.6.4/lib/webapp2/webapp2.py", line 570, in dispatch
return method(*args, **kwargs)
File "/home/tigerstyle/orbit/orbit/orbit/handlers.py", line 239, in post
user = User.get_by_auth_password(auth_id, password)
File "/opt/google_appengine_1.6.4/lib/webapp2/webapp2_extras/appengine/auth/models.py",    line 301, in get_by_auth_password
raise auth.InvalidPasswordError()
InvalidPasswordError
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T09:48:31+00:00Added an answer on June 3, 2026 at 9:48 am

    You can use try / except to control your login flow:

    def post(self):
      """
      username: Get the username from POST dict
      password: Get the password from POST dict
      """
      username = self.request.POST.get('username')
      password = self.request.POST.get('password')
      # Try to login user with password
      # Raises InvalidAuthIdError if user is not found
      # Raises InvalidPasswordError if provided password doesn't match with specified user
      try:
        self.auth.get_user_by_password(username, password)
        self.redirect('/secure')
      except (InvalidAuthIdError, InvalidPasswordError), e:
        # Returns error message to self.response.write in the BaseHandler.dispatcher
        # Currently no message is attached to the exceptions
        return e
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using custom UserNamePasswordValidator for User Authentication. Following is the code and it
I'm trying to disable/enable controls based on user permission using a custom security framework
I wrote a custom control inherited from WebControl. (Note: not a user control). using
When using custom assemblies in a visual studio project. How does one check in
I'm using custom renderer on JList, but none of components rendered are accessible. list.setCellRenderer(new
I am using custom model binder in ASP.NET MVC 2 that looks like this:
Our SSO login process uses Forms Authentication against a custom user store in SQL
Is there a way to only return Accounts (using SOQL) that the current user
I'm building an internal (intranet) MVC3 application using Windows Authentication and a custom role
I have started using custom intents in my application and I have come across

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.