<s> from registration . backends . simple . views import RegistrationView <EOL> from django . contrib . auth import logout , login , authenticate <EOL> from django . views . generic import View <EOL> from django . shortcuts import render , redirect <EOL> from django . http . response import Http404 <EOL> from django . conf import settings <EOL> from django . utils . translation import ugettext as _ <EOL> from ide . api import json_failure , json_response <EOL> class IdeRegistrationView ( RegistrationView ) : <EOL> def get_success_url ( self , * args , ** kwargs ) : <EOL> return "<STR_LIT>" <EOL> class IdeRegistrationMissingView ( View ) : <EOL> def get ( self , request , * args , ** kwargs ) : <EOL> raise Http404 ( ) <EOL> def logout_view ( request ) : <EOL> logout ( request ) <EOL> return redirect ( "<STR_LIT:/>" ) <EOL> def login_action ( request ) : <EOL> username = request . REQUEST [ '<STR_LIT:username>' ] <EOL> password = request . REQUEST [ '<STR_LIT:password>' ] <EOL> user = authenticate ( username = username , password = password ) <EOL> if user is None : <EOL> return json_failure ( _ ( "<STR_LIT>" ) ) <EOL> if not user . is_active : <EOL> return json_failure ( _ ( "<STR_LIT>" ) ) <EOL> login ( request , user ) <EOL> return json_response ( ) </s>
