Add IntelliJ IDEA project configuration files
This commit adds IntelliJ IDEA-specific configuration files for the project, including module setup, version control integration, inspection profiles, and workspace settings. These files facilitate development environment configuration for contributors using IntelliJ IDEA.master
parent
da83ae7afc
commit
0eefaad424
@ -1,7 +1,47 @@
|
|||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.contrib.auth.forms import AuthenticationForm
|
from django.contrib.auth.forms import AuthenticationForm
|
||||||
|
from django.core.exceptions import ValidationError
|
||||||
|
from django.forms import CharField
|
||||||
|
from django.forms.models import ModelForm
|
||||||
|
from django.forms.widgets import PasswordInput
|
||||||
|
|
||||||
|
|
||||||
class LoginForm(AuthenticationForm):
|
class LoginForm(AuthenticationForm):
|
||||||
field_order = ['username', 'password']
|
field_order = ['username', 'password']
|
||||||
class Meta:
|
class Meta:
|
||||||
model = get_user_model()
|
model = get_user_model()
|
||||||
|
|
||||||
|
|
||||||
|
class RegisterForm(ModelForm):
|
||||||
|
password1 = CharField(label='Password', widget=PasswordInput)
|
||||||
|
password2 = CharField(label='Confirm Password', widget=PasswordInput)
|
||||||
|
|
||||||
|
field_order = ['username', 'email', 'password1', 'password2', 'phone_number', 'line', 'company_permissions']
|
||||||
|
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = get_user_model()
|
||||||
|
fields = ['username', 'email', 'password1', 'password2', 'phone_number', 'line', 'company_permissions']
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
self.fields['password1'].widget.attrs.update({'autocomplete': 'new-password'})
|
||||||
|
self.fields['password2'].widget.attrs.update({'autocomplete': 'new-password'})
|
||||||
|
|
||||||
|
|
||||||
|
def clean(self):
|
||||||
|
cleaned_data = super().clean()
|
||||||
|
password1 = cleaned_data.get('password1')
|
||||||
|
password2 = cleaned_data.get('password2')
|
||||||
|
|
||||||
|
if password1 and password2 and password1 != password2:
|
||||||
|
raise ValidationError("Passwords don't match")
|
||||||
|
return cleaned_data
|
||||||
|
|
||||||
|
def save(self, commit=True):
|
||||||
|
user = super().save(commit=False)
|
||||||
|
user.set_password(self.cleaned_data['password1'])
|
||||||
|
if commit:
|
||||||
|
user.save()
|
||||||
|
return user
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,46 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Title</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<video id="video" autoplay></video>
|
||||||
|
<canvas id="canvas" style="display:none;"></canvas>
|
||||||
|
<button onclick="takePhoto()">Take Photo</button>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const video = document.getElementById('video');
|
||||||
|
|
||||||
|
// Request camera access
|
||||||
|
navigator.mediaDevices.getUserMedia({ video: true })
|
||||||
|
.then(stream => video.srcObject = stream)
|
||||||
|
.catch(err => console.error("Camera access denied", err));
|
||||||
|
|
||||||
|
function takePhoto() {
|
||||||
|
const canvas = document.getElementById('canvas');
|
||||||
|
canvas.width = video.videoWidth;
|
||||||
|
canvas.height = video.videoHeight;
|
||||||
|
|
||||||
|
// Draw current frame
|
||||||
|
const context = canvas.getContext('2d');
|
||||||
|
context.drawImage(video, 0, 0);
|
||||||
|
|
||||||
|
// Convert to base64 or Blob
|
||||||
|
canvas.toBlob(blob => {
|
||||||
|
// Upload blob to server
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append("photo", blob, "photo.jpg");
|
||||||
|
|
||||||
|
fetch("https://your-upload-url.com/upload", {
|
||||||
|
method: "POST",
|
||||||
|
body: formData
|
||||||
|
}).then(res => console.log("Uploaded"))
|
||||||
|
.catch(err => console.error("Upload failed", err));
|
||||||
|
}, "image/jpeg");
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
||||||
|
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Register User</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<form method="post">
|
||||||
|
{% csrf_token %}
|
||||||
|
{{ form.as_p }}
|
||||||
|
<button type="submit">Register</button>
|
||||||
|
</form>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
Reference in New Issue