Esempio n. 1
0
def loginn(request):
    
    page = 'Login'
    module = 'Login'
    args = {}
    args.update(csrf(request))
    if request.method == 'POST':
        args['email']= request.POST['email']
        args['error_message']=[]
        args = emailid_validate(request,args)
        if args['error_message']:
            return render_to_response('login/tologin.html',args)            
        loginlist = validate_login(request) 
## If the emailid exists, then call the page according to the role
        if (loginlist==1):      
            return HttpResponseRedirect("/get_multi_roles/")
## If the emailid does not exist,display error message
        elif (loginlist == 0):
             return HttpResponseRedirect("/blendedadmin_home/")
        elif (loginlist == 2):
             return HttpResponseRedirect("/bmchome")
        elif (loginlist == 3):
             return HttpResponseRedirect("/courseadminhome/")
        elif (loginlist == 4):
            error_message=retrieve_error_message(module,page,'LN_INV')##required to create error content message           
            args['error_message']=error_message
            return render_to_response('login/tologin.html',args)              

        else:
            error_message=retrieve_error_message(module,page,'LN_INV')            
            args['error_message']=error_message
            return render_to_response('login/tologin.html',args)            
    return render_to_response('login/tologin.html',args)
Esempio n. 2
0
def loginn(request):
    page = 'Login'
    module = 'Registration'
    args = {}
    args.update(csrf(request))
    if request.method == 'POST':
        
	
        list1 = validate_login(request)
        
        if (list1!=-1):      
            
            args['institutename']=list1[1]            
            args['firstname']=list1[2]
            args['lastname']=list1[3]
            #return render_to_response('login/login_success.html',args)
            return ccourse(request)
        else:
            error_message=retrieve_error_message (module,page,'LN_INV')
            args = {}
            args.update(csrf(request))
            args['error_message']=error_message
            return render_to_response('login/tologin.html',args)            

            #return HttpResponseRedirect('/login_success/')
    args = {}
    args.update(csrf(request))        
    return render_to_response('login/tologin.html',args)