MCPcopy
hub / github.com/liangliangyy/DjangoBlog / get_redirecturl

Function get_redirecturl

oauth/views.py:30–45  ·  view source on GitHub ↗
(request)

Source from the content-addressed store, hash-verified

28
29
30def get_redirecturl(request):
31 nexturl = request.GET.get('next_url', None)
32 if not nexturl or nexturl == '/login/' or nexturl == '/login':
33 return '/'
34
35 # Only allow relative URLs or URLs pointing to the current host
36 site_domain = get_current_site().domain
37 if url_has_allowed_host_and_scheme(
38 url=nexturl,
39 allowed_hosts={site_domain},
40 require_https=request.is_secure()
41 ):
42 return nexturl
43
44 logger.info('非法url:' + str(nexturl))
45 return '/'
46
47
48def oauthlogin(request):

Callers 2

oauthloginFunction · 0.85
authorizeFunction · 0.85

Calls 2

get_current_siteFunction · 0.90
getMethod · 0.45

Tested by

no test coverage detected