~stephen-stewart/canonical-identity-provider/2fa-css-counters

« back to all changes in this revision

Viewing changes to src/api/v20/handlers.py

  • Committer: Tarmac
  • Author(s): Michael Foord
  • Date: 2013-08-30 14:55:15 UTC
  • mfrom: (1001.3.39 api-web)
  • Revision ID: tarmac-20130830145515-xgc36lfqb355ftxo
[r=mfoord,ricardokirkner,bloodearnest] Check that passwords match the required policy (for the user) on login. Prevent login, and prompt to reset password, if the password is not secure enough.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
    AccountDeactivated,
29
29
    AccountSuspended,
30
30
    AuthenticationError,
 
31
    EmailInvalidated,
 
32
    PasswordPolicyError,
31
33
    authenticate_user,
32
 
    EmailInvalidated,
33
34
)
34
35
from identityprovider.models import (
35
36
    Account,
270
271
            return errors.ACCOUNT_DEACTIVATED()
271
272
        except EmailInvalidated:
272
273
            return errors.EMAIL_INVALIDATED()
 
274
        except PasswordPolicyError as e:
 
275
            return errors.PASSWORD_POLICY_ERROR(
 
276
                reason=unicode(e), location=settings.SSO_ROOT_URL)
273
277
        except AuthenticationError:
274
278
            return errors.INVALID_CREDENTIALS()
275
279
 
333
337
            return errors.ACCOUNT_SUSPENDED()
334
338
        except AccountDeactivated:
335
339
            return errors.ACCOUNT_DEACTIVATED()
 
340
        except PasswordPolicyError as e:
 
341
            return errors.PASSWORD_POLICY_ERROR(
 
342
                reason=unicode(e), location=settings.SSO_ROOT_URL)
336
343
        except AuthenticationError:
337
344
            return errors.INVALID_CREDENTIALS()
338
345