-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
- Loading branch information
1 parent
a911776
commit d0a118c
Showing
6 changed files
with
79 additions
and
73 deletions.
There are no files selected for viewing
This file contains 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 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 |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = '1.0.0' | ||
__version__ = "1.0.0" |
This file contains 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 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 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 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 |
---|---|---|
@@ -1,30 +1,29 @@ | ||
import cherrypy | ||
|
||
from social_core.utils import setting_name, module_member | ||
from social_core.actions import do_auth, do_complete, do_disconnect | ||
from social_core.utils import module_member, setting_name | ||
|
||
from .utils import psa | ||
|
||
|
||
class CherryPyPSAViews(object): | ||
class CherryPyPSAViews: | ||
@cherrypy.expose | ||
@psa('/complete/%(backend)s') | ||
@psa("/complete/%(backend)s") | ||
def login(self, backend): | ||
return do_auth(self.backend) | ||
|
||
@cherrypy.expose | ||
@psa('/complete/%(backend)s') | ||
@psa("/complete/%(backend)s") | ||
def complete(self, backend, *args, **kwargs): | ||
login = cherrypy.config.get(setting_name('LOGIN_METHOD')) | ||
login = cherrypy.config.get(setting_name("LOGIN_METHOD")) | ||
do_login = module_member(login) if login else self.do_login | ||
user = getattr(cherrypy.request, 'user', None) | ||
user = getattr(cherrypy.request, "user", None) | ||
return do_complete(self.backend, do_login, user=user, *args, **kwargs) | ||
|
||
@cherrypy.expose | ||
@psa() | ||
def disconnect(self, backend, association_id=None, csrfmiddlewaretoken=None): | ||
user = getattr(cherrypy.request, 'user', None) | ||
user = getattr(cherrypy.request, "user", None) | ||
return do_disconnect(self.backend, user, association_id) | ||
|
||
def do_login(self, backend, user, social_user): | ||
backend.strategy.session_set('user_id', user.id) | ||
backend.strategy.session_set("user_id", user.id) |