Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Django custom authentication

def getLogin(request):
    if request.user.is_authenticated:
        return redirect('index')
    else:
        if request.method == "POST":
            user = request.POST.get('user')
            password = request.POST.get('pass')
            auth = authenticate(request, username=user, password=password)
            if auth is not None:
                login(request, auth)
                return redirect('index')
        return render(request, "login.html")
Comment

Django custom authentication

<form action="" method="POST">
    <div class="form-group">
        <label for="email" class="active">Email address</label>
        <input type="email" name="email" class="form-control" id="email" placeholder="Enter email">
        <div class="email-mg"></div>
    </div>
    <div class="form-group">
        <label for="password" class="active">Password</label>
        <input type="password" name="password" class="form-control" id="password" placeholder="Password">
        <div class="pass-mg"></div>
    </div>
    <button type="submit" class="btn btn-primary btn-block waves-effect waves-light" id="loginBtn">Log in</button>
</form>
Comment

PREVIOUS NEXT
Code Example
Python :: python convert 12 hour time to 24 hour 
Python :: python import matplotlib 
Python :: yahoo finance python documentation 
Python :: ord() in python 
Python :: how to convert categorical data to numerical data in python 
Python :: seaborn histplot python 
Python :: django httpresponse 
Python :: sum values in django models and insert value in model field 
Python :: linear regression python code 
Python :: def calc_mean_mode(df, column_name) 
Python :: find the sitepckages for anaconda 
Python :: displace items in array python 
Python :: _getexif 
Python :: python data types 
Python :: Is there a do ... until in Python 
Python :: python eliptic curve matplotlib 
Python :: from string to flaot python numpy 
Python :: matplotlib remove white lines between contour 
Python :: python aggregate count and sum 
Python :: STATPC 
Python :: simple keras model with one layer 
Python :: how to get maximum value of number in python 
Python :: django set cookie 
Python :: append two dfs 
Python :: 9x9 grid tkinter 
Python :: hide grid imshow 
Python :: sample adaboost classifier algorithm 
Python :: python time.sleep 
Python :: mechanize python #3 
Python :: pyton como identificar se é numero 
ADD CONTENT
Topic
Content
Source link
Name
8+8 =