Groups: |
|
---|
Add ability to use email in Gitlab authentication
Review Request #5591 — Created March 8, 2014 and submitted
Older versions of Gitlab API v3 only allow authentication using email instead of "login" parameter that Review board currently uses.
See https://github.com/gitlabhq/gitlabhq/commit/559e83d30004e0c41a30f4ce3463f695eb7e26a1
Unit tests pass. Tested authentication with email againts different versions of Gitlab.
-
-
reviewboard/hostingsvcs/gitlab.py (Diff revision 1) Using the ternary here in the key name isn't particularly readable. How about pulling the key out into a variable and using a plain conditional?
if self._is_email(username): login_key = 'email' else: login_key = 'login' rsp, headers = self._json_post( url=self._build_api_url(hosting_url, 'session'), fields={ login_key: username, 'password': password, })
You could maybe even replace the conditional with try/except and get rid of the
_is_email
method.
Change Summary:
Fix raised issues
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 2 (+18 -1) |
-
-
reviewboard/hostingsvcs/gitlab.py (Diff revision 2) This shouldn't be necessary. Just defining login_key inside the conditional is fine.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 3 (+17 -1) |