Merge lp:~cjwatson/canonical-identity-provider/twofactor-required-error into lp:canonical-identity-provider/release

Proposed by Colin Watson
Status: Merged
Approved by: Colin Watson
Approved revision: no longer in the source branch.
Merge reported by: Ubuntu One Auto Pilot
Merged at revision: not available
Proposed branch: lp:~cjwatson/canonical-identity-provider/twofactor-required-error
Merge into: lp:canonical-identity-provider/release
Diff against target: 62 lines (+9/-5)
2 files modified
docs/api.txt (+7/-4)
src/api/v20/utils.py (+2/-1)
To merge this branch: bzr merge lp:~cjwatson/canonical-identity-provider/twofactor-required-error
Reviewer Review Type Date Requested Status
Celso Providelo (community) Approve
Review via email: mp+305737@code.launchpad.net

Commit message

Assign a distinct "twofactor-required" error code.

Description of the change

Assign a distinct "twofactor-required" error code.

These errors only moved over to the new style last week, so I think it's unlikely anyone's depending on this being conflated with CAPTCHA_REQUIRED.

To post a comment you must log in.
Revision history for this message
Celso Providelo (cprov) wrote :

Thanks, Colin.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'docs/api.txt'
2--- docs/api.txt 2016-09-02 11:31:05 +0000
3+++ docs/api.txt 2016-09-14 16:52:23 +0000
4@@ -154,23 +154,23 @@
5 These are the codes used in the response and their meanings:
6
7 - ``account-not-ready``: the account is deactivated, suspended or account email
8- is not valildated.
9+ is not validated.
10
11 - ``bad-request``: there is a problem in the structure of the request.
12
13+- ``field-required``: the field in the request can't be empty or null.
14+
15 - ``internal-server-error``: some unexpected problem server side; this will be
16 the code in all 5xx cases.
17
18 - ``invalid-credentials``: the credentials for the authentication are not valid
19- (e.g.: the username, password are not correct, the 2 factor is needed, etc).
20+ (e.g.: the username or password is not correct).
21
22 - ``invalid-data``: the data is incorrect or corrupt.
23
24 - ``permission-required``: the macaroon authorization is missing in
25 the received request or not enough for it to be fulfilled.
26
27-- ``required``: the field in the request can't be empty or null.
28-
29 - ``resource-not-found``: one or more fields are included to specify a
30 resource, but it is not found in the Store.
31
32@@ -178,6 +178,9 @@
33 ready yet for that purpose; normally something else would need to be done
34 first on the resource before this request can be repeated.
35
36+- ``twofactor-required``: two-factor authentication is required for this
37+ request but was not provided.
38+
39 - ``user-not-ready``: the user is not ready to issue the received request;
40 normally some actions would need to be done in the user account before
41 repeating the request.
42
43=== modified file 'src/api/v20/utils.py'
44--- src/api/v20/utils.py 2016-09-02 11:31:05 +0000
45+++ src/api/v20/utils.py 2016-09-14 16:52:23 +0000
46@@ -69,6 +69,7 @@
47 REQUIRED = 'field-required'
48 RESOURCE_NOT_FOUND = 'resource-not-found'
49 RESOURCE_NOT_READY = 'resource-not-ready'
50+ TWOFACTOR_REQUIRED = 'twofactor-required'
51
52 def __init__(self):
53 self._codes = {getattr(self, code) for code in dir(self)
54@@ -91,7 +92,7 @@
55
56 TWOFACTOR_REQUIRED=(
57 401, _("2-factor authentication required."),
58- ErrorCode.REQUIRED),
59+ ErrorCode.TWOFACTOR_REQUIRED),
60
61 ACCOUNT_SUSPENDED=(
62 403, _('Your account has been suspended. Please contact login '