Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

fix: drop customerpassword #1062

Merged
merged 1 commit into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions timed/projects/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from timed.forms import DurationInHoursField
from timed.projects import models
from timed.redmine.admin import RedmineProjectInline
from timed.subscription.admin import CustomerPasswordInline


class CustomerAssigneeInline(admin.TabularInline):
Expand All @@ -36,7 +35,7 @@ class CustomerAdmin(admin.ModelAdmin):

list_display = ["name"]
search_fields = ["name"]
inlines = [CustomerPasswordInline, CustomerAssigneeInline]
inlines = [CustomerAssigneeInline]

def has_delete_permission(self, request, obj=None):
return obj and not obj.projects.exists()
Expand Down
15 changes: 0 additions & 15 deletions timed/subscription/admin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import hashlib

from django import forms
from django.contrib import admin
from django.utils.translation import gettext_lazy as _
Expand All @@ -18,16 +16,3 @@ class PackageForm(forms.ModelForm):
class PackageAdmin(admin.ModelAdmin):
list_display = ["billing_type", "duration", "price"]
form = PackageForm


class CustomerPasswordForm(forms.ModelForm):
def save(self, commit=True):
password = self.cleaned_data.get("password")
if password is not None:
self.instance.password = hashlib.md5(password.encode()).hexdigest()
return super().save(commit=commit)


class CustomerPasswordInline(admin.StackedInline):
form = CustomerPasswordForm
model = models.CustomerPassword
16 changes: 16 additions & 0 deletions timed/subscription/migrations/0008_delete_customerpassword.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Generated by Django 4.2.11 on 2024-04-22 07:50

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('subscription', '0007_alter_package_price_currency'),
]

operations = [
migrations.DeleteModel(
name='CustomerPassword',
),
]
13 changes: 0 additions & 13 deletions timed/subscription/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from django.conf import settings
from django.db import models
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from djmoney.models.fields import MoneyField


Expand Down Expand Up @@ -40,15 +39,3 @@ class Order(models.Model):
blank=True,
related_name="orders_confirmed",
)


class CustomerPassword(models.Model):
"""
Password per customer used for login into SySupport portal.

Password are only hashed with md5. This model will be obsolete
once customer center will go live.
"""

customer = models.OneToOneField("projects.Customer", on_delete=models.CASCADE)
password = models.CharField(_("password"), max_length=128, null=True, blank=True)