Browse Source

add login/logout views (those will be moved to djextdirect sooner or later)

Natenom/support-murmur-13-1446181288462
Michael Ziegler 15 years ago
parent
commit
8fabd54ff2
  1. 23
      pyweb/mumble/views.py

23
pyweb/mumble/views.py

@ -37,9 +37,26 @@ from djextdirect import Provider
EXT_DIRECT_PROVIDER = Provider() EXT_DIRECT_PROVIDER = Provider()
@EXT_DIRECT_PROVIDER.register_method( "omgfu" )
def ohai( request ):
return "plzkthx"
@EXT_DIRECT_PROVIDER.register_method( "Accounts" )
def login( request, username, passwd ):
from django.contrib.auth import authenticate, login as djlogin
if request.user.is_authenticated():
return { 'success': True }
user = authenticate( username=username, password=passwd )
if user:
if user.is_active:
djlogin( request, user )
return { 'success': True }
else:
return { 'success': False, 'error': 'account disabled' }
else:
return { 'success': False, 'error': 'invalid credentials' }
@EXT_DIRECT_PROVIDER.register_method( "Accounts" )
def logout( request ):
from django.contrib.auth import logout as djlogout
djlogout( request )
return { 'success': True }
def redir( request ): def redir( request ):
""" Redirect to the servers list. """ """ Redirect to the servers list. """

Loading…
Cancel
Save