Commit fdba7023 authored by Muhamad's avatar Muhamad

login, welcome

parent 1b750968
...@@ -39,5 +39,7 @@ urlpatterns = [ ...@@ -39,5 +39,7 @@ urlpatterns = [
path('userprofile/', views.Userprofile.as_view(), name='userprofile'), path('userprofile/', views.Userprofile.as_view(), name='userprofile'),
path('changepassword/', views.changepassword, name="changepassword"), path('changepassword/', views.changepassword, name="changepassword"),
path('editprofile/', views.editprofile, name='editprofile'), path('editprofile/', views.editprofile, name='editprofile'),
path('editpp/', views.editpp, name='editpp') path('editpp/', views.editpp, name='editpp'),
path('welcome', views.welcom)
]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) ]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
\ No newline at end of file
from django.contrib import auth from django.contrib import auth
from django.db.models.expressions import F from django.db.models.expressions import F
from django.http import request, response from django.http import request, response, HttpResponseRedirect
from django.views import View, generic from django.views import View, generic
from django.shortcuts import render from django.shortcuts import render, redirect
from django.contrib import messages from django.contrib import messages
from django.contrib.auth.views import LoginView, LogoutView from django.contrib.auth.views import LoginView, LogoutView
from django.db import connection as conn, models from django.db import connection as conn, models
...@@ -13,7 +13,7 @@ from django.contrib.auth.hashers import make_password ...@@ -13,7 +13,7 @@ from django.contrib.auth.hashers import make_password
from rest_framework import status from rest_framework import status
from rest_framework.decorators import api_view, renderer_classes from rest_framework.decorators import api_view, renderer_classes
from rest_framework.response import Response from rest_framework.response import Response
from django.contrib.auth import authenticate from django.contrib.auth import authenticate, login
from django.core.files.storage import FileSystemStorage from django.core.files.storage import FileSystemStorage
import random import random
import string import string
...@@ -22,8 +22,24 @@ import string ...@@ -22,8 +22,24 @@ import string
# Create your views here. # Create your views here.
class CustomLoginView(LoginView): class CustomLoginView(LoginView):
template_name = 'user/login.html' def get(self, request):
redirect_authenticated_user = True if request.user.is_authenticated:
return render(request, 'layout/layout.html')
else:
return render(request, 'user/login.html')
def post(self, request):
username = request.POST['username']
password = request.POST['password']
user = authenticate(request, username=username, password=password)
# print(user)
if user is not None:
login(request, user)
return redirect("/welcome")
else:
messages.error(request, "Invalid username or password.")
return render(request, 'user/login.html')
class HomeView(View): class HomeView(View):
template_name = 'layout/layout.html' template_name = 'layout/layout.html'
...@@ -759,3 +775,6 @@ def editpp(request): ...@@ -759,3 +775,6 @@ def editpp(request):
return Response(data) return Response(data)
def welcom(request):
return render(request, "layout/welcome.html")
\ No newline at end of file
<svg width="26" height="26" viewBox="0 0 26 26" fill="none" xmlns="http://www.w3.org/2000/svg"> <svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M9.75 18.6875L3.25 20.3125V5.6875L9.75 4.0625" stroke="#E86250" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> <path d="M12 23L4 25V7L12 5" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M16.25 21.9375L9.75 18.6875V4.0625L16.25 7.3125V21.9375Z" stroke="#E86250" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> <path d="M20 27L12 23V5L20 9V27Z" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M16.25 7.3125L22.75 5.6875V20.3125L16.25 21.9375" stroke="#E86250" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/> <path d="M20 9L28 7V25L20 27" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg> </svg>
This diff is collapsed.
<svg width="1440" height="1024" viewBox="0 0 1440 1024" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="1440" height="1024" fill="#090909" fill-opacity="0.25"/>
</svg>
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Welcome</title>
</head>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"></script>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p/We" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-U1DAWAznBHeqEIlVSCgzq+c9gqGAJn5c/t99JyeKa9xxaYpSvHU5awsuZVVFIhvj" crossorigin="anonymous"></script>
<link href="https://fonts.googleapis.com/css?family=Roboto:400,300,100,500,700,900" rel="stylesheet" type="text/css">
<link href="{% static 'css/icons/icomoon/styles.css' %}" rel="stylesheet" type="text/css">
<link href="{% static 'css/bootstrap.css' %}" rel="stylesheet" type="text/css">
<link href="{% static 'css/core.css' %}" rel="stylesheet" type="text/css">
<link href="{% static 'css/components.css' %}" rel="stylesheet" type="text/css">
<link href="{% static 'css/colors.css' %}" rel="stylesheet" type="text/css">
<style>
@font-face {
font-family: 'gilroybold';
src: url('/static/css/gilroy-bold.woff') format('woff');
}
@font-face {
font-family: 'gilroylight';
src: url('/static/css/gilroy-light.woff') format('woff');
}
@font-face {
font-family: 'gilroysemibold';
src: url('/static/css/gilroy-semibold.woff') format('woff');
}
@font-face {
font-family: 'gilroymedium';
src: url('/static/css/Gilroy-Medium.woff') format('woff');
}
@font-face {
font-family: 'gilroyreguler';
src: url('/static/css/Gilroy-Regular.woff') format('woff');
}
@font-face {
font-family: 'gilroythin';
src: url('/static/css/Gilroy-Thin.woff') format('woff');
}
@font-face {
font-family: 'gilroyultralight';
src: url('/static/css/Gilroy-UltraLight.woff') format('woff');
}
</style>
<body>
<div style="background: url(/static/img/icon-1/bg1.png);
width: 100%;
height: 100%;
background-size: 100% 100%;">
<!-- <div> -->
<div style=" position: absolute;
background: url(/static/img/icon-1/bg4.svg);
width: 742px;
height: 130px;
bottom: 15%;
left: 10%;"></div>
<div style="position: absolute;background: url(/static/img/icon-1/bg3.svg);width: 65%;height: 75%;top: 0;left: 35%;background-size: 100% 100%;z-index: 9;"></div>
<!-- </div> -->
<div style="height: 100vh;width: 100%;background-color: rgba(9, 9, 9, 0.3);margin:0px;">
<div style="margin-left: 10%;padding-top: 10%;">
<div style="/* margin-top: 10%; */font-size: 50px;color: white;font-family: 'gilroybold';">
Hai {{user.username}},
</div>
<div style="font-size: 50px;color: white;font-family: 'gilroylight';">
Selamat datang di website
</div>
<div style="font-size: 60px;color: #1F6ABD;font-family: 'gilroybold';">
Temanku!
</div>
<div style="font-size: 30px;color: white;font-family:'gilroylight';">
Sistem Informasi Pembangunan OKU
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.3/dist/umd/popper.min.js" integrity="sha384-eMNCOe7tC1doHpGoWe/6oMVemdAVTMs2xqW4mwXrXsW0L84Iytr2wi5v2QjrP/xp" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/js/bootstrap.min.js" integrity="sha384-cn7l7gDp0eyniUwwAZgrzD06kc/tftFf19TOAs2zVinnD/C7E91j9yyk5//jjpt/" crossorigin="anonymous"></script>
<script src="{% static 'js/plugins/notifications/sweet_alert.min.js' %}"></script>
</body>
</html>
<script>
setTimeout(function() {
window.location.href = "{% url 'apps:dashboard' %}";
}, 1000);
</script>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment