forked from pwalsh/openbudgets
-
Notifications
You must be signed in to change notification settings - Fork 27
Added social auth... #405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
BeOleg
wants to merge
40
commits into
hasadna:develop
Choose a base branch
from
BeOleg:social_auth
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Added social auth... #405
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
27b9ba6
Merge branch 'develop' of https://github.com/prjts/openbudgets into d…
Tudmotu 6f3e3a5
Merge branch 'develop' of https://github.com/prjts/openbudgets into d…
Tudmotu 877e8e6
BREAKING; Removed vendor dir.
Tudmotu 975919e
Added bower files.
Tudmotu 154a93f
STILL BREAKING; Added new bower deps.
Tudmotu 7a62df1
idos tired commit
idoivri 07e736b
fix
idoivri de224fd
Fixed jqScroll and setImmediate dependencies.
Tudmotu f60101e
Migrated all files [hopefully] to use the new dir structure of bower.
Tudmotu 6a71cc2
Merge branch 'develop' of https://github.com/hasadna/omuni-budget int…
Tudmotu 8dc9189
Merge branch 'develop' into feature/volo-to-bower
Tudmotu 9cd4dd7
fix 355
dovp 234cd85
fix 166 - Home page design implementation
dovp 2358b76
Added social auth...
d83e4d8
Added requirements, removed unneeded imports from exception middlewar…
f941e4d
Added strict unique email constraint
69a839b
Removed break point
2ad75db
Added message param
7d4b614
Type fix, paramaterized unique email excpetion
eefeeaf
Reset requirements to project's default + django-social-auth 0.7.28
95000c8
Removed uneeded balnk spaces, and a markup error
61f7512
Some more aliasing and shim fixes.
Tudmotu a68a8d7
Added alias for spin.js.
Tudmotu 4074506
Merge branch 'develop' of https://github.com/hasadna/omuni-budget int…
Tudmotu 6fc8016
Merge pull request #403 from idoivri/develop
pwalsh abeb563
Merge pull request #404 from dovp/develop
pwalsh 05ef643
Last enhancements towrds a merge
fb1ee77
added an explanation about social credentials
ac18294
Cleaned up and updated JS dependencies
ydaniv ee71430
Updated uijet to 0.0.34
ydaniv 9a5c366
Fixed explorer app to use updated dependencies
ydaniv 650f643
Updated JS dependencies
ydaniv 9c3c79b
Merge branch 'develop' of https://github.com/hasadna/openmuni-budgets…
ydaniv 66cd83e
Updated processed base css files
ydaniv 1441faf
Update requirements.txt
pwalsh 6749cd0
Making the pattern to loading local.py much easier so it is on by def…
pwalsh 3faba06
Merge branch 'develop' of https://bitbucket.org/pwalsh/openbudgets in…
pwalsh f0b76ea
clean
pwalsh 841760f
Merge branch 'develop' of github.com:hasadna/openmuni-budgets into de…
pwalsh 44d074e
Merge branch 'social_auth' of github.com:BeOleg/openmuni-budgets into…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "directory": "./openbudgets/commons/static/vendor" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| { | ||
| "name": "openmuni-budgets", | ||
| "version": "0.0.1", | ||
| "dependencies": { | ||
| "uijet": "~0.0.30", | ||
| "eventbox": "~0.1.2", | ||
| "mustache": "0.7.3", | ||
| "jquery": "~2.1.0", | ||
| "adaptabl": "latest", | ||
| "jquery-mousewheel": "~3.1.3", | ||
| "jqScroll": "ydaniv/jqScroll", | ||
| "spin": "spinjs#~1.3.3", | ||
| "requirejs": "~2.1.11", | ||
| "q": "~1.0.0", | ||
| "backbone": "amdjs/backbone#~1.1.0", | ||
| "setImmediate": "git://github.com/NobleJS/setImmediate.git#1.0.1", | ||
| "backbone-fetch-cache": "~1.4.0", | ||
| "d3": "~3.4.1", | ||
| "underscore": "lodash#~2.4.1" | ||
| }, | ||
| "resolutions": { | ||
| "jquery": "~2.1.0" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| from social_auth.middleware import SocialAuthExceptionMiddleware | ||
| from django.conf import settings | ||
|
|
||
|
|
||
| class OpenBudgetsSocialAuthExceptionMiddleware(SocialAuthExceptionMiddleware): | ||
| def get_redirect_uri(self, request, exception): | ||
| return settings.LOGIN_URL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| from social_auth.exceptions import SocialAuthBaseException | ||
| from django.utils.translation import ugettext as _ | ||
|
|
||
|
|
||
| class NonIdenticalEmailAddress(SocialAuthBaseException): | ||
| def __unicode__(self): | ||
| return _(u'Identical email error: {message}').format(message=self.message) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| from django.core.exceptions import MultipleObjectsReturned, ObjectDoesNotExist | ||
| from django.utils.translation import ugettext | ||
| from social_auth.models import UserSocialAuth | ||
| from .models import Account | ||
| from social_auth.exceptions import AuthException | ||
| from social_exceptions import NonIdenticalEmailAddress | ||
|
|
||
|
|
||
| def associate_by_email(details, user=None, *args, **kwargs): | ||
| """Return user entry with same email address as one returned on details.""" | ||
| email = details.get('email', None) | ||
|
|
||
| if user and user.email == email: | ||
| return None | ||
| elif not email or (user and user.email != email): | ||
| msg = ugettext('Social email address and account email ' + | ||
| 'address must be idnetical') | ||
| raise NonIdenticalEmailAddress(msg) | ||
| if email: | ||
| # Try to associate accounts registered with the same email address, | ||
| # only if it's a single object. AuthException is raised if multiple | ||
| # objects are returned. | ||
| try: | ||
| return {'user': UserSocialAuth.get_user_by_email(email=email)} | ||
| except MultipleObjectsReturned: | ||
| raise AuthException(kwargs['backend'], 'Not unique email address.') | ||
| except ObjectDoesNotExist: | ||
| pass | ||
|
|
||
|
|
||
| def create_user(backend, details, response, uid, username, user=None, *args, | ||
| **kwargs): | ||
| """Create user. Depends on get_username pipeline.""" | ||
| if user: | ||
| return {'user': user} | ||
| if not username: | ||
| return None | ||
|
|
||
| # Avoid hitting field max length | ||
| email = details.get('email') | ||
| original_email = None | ||
| if email and UserSocialAuth.email_max_length() < len(email): | ||
| original_email = email | ||
| email = '' | ||
| first_name = details.get('first_name', 'John') | ||
| last_name = details.get('last_name', 'Doe') | ||
| password = Account.objects.make_random_password() | ||
|
|
||
| return { | ||
| 'user': UserSocialAuth.create_user(username=username, email=email, | ||
| first_name=first_name, | ||
| last_name=last_name, | ||
| password=password), | ||
| 'original_email': original_email, | ||
| 'is_new': True | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 31 additions & 17 deletions
48
openbudgets/apps/entities/static/entities/explorer/main.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BeOleg
<input>is a non-content element. Perhaps it would be better to replace it with a<button>tag and put the{{ provider }}as its content?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is to have a
-sign side by side with the network's name, to symbolize the revoke of the credentials of this certain network.Same thing can be achieved by placing
{{provider}}in the 'value' attribute of theinputelement, abuttonelement will work as well, as long as it's has atype='submit'attribute, since I only accept POST request to the credentials revoke resource to prevent XSS.Wanted to enhance the design of this entire thing, but frankly could not figure out which less file applies to this section :(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't worry abut UI behaviour, until we do new UI work with Ran.