settings
+ logging when user is altered + password changing (with log entry)
This commit is contained in:
parent
75fcd2648e
commit
174a9da501
6 changed files with 96 additions and 3 deletions
|
|
@ -2,6 +2,8 @@ from django.shortcuts import render
|
|||
from .forms import SettingsForm
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.contrib.auth.models import User
|
||||
from django.conf import settings
|
||||
from django.utils import timezone
|
||||
|
||||
|
||||
# Create your views here.
|
||||
|
|
@ -22,6 +24,16 @@ def index(request):
|
|||
form = SettingsForm(request.POST)
|
||||
|
||||
if form.is_valid():
|
||||
|
||||
log = open(settings.LOGFILE, 'a')
|
||||
log.write(
|
||||
'\n[' + str(timezone.now()) + ']' + ' MODIFY_USER: BEFORE(|NAME: ' + user.username +
|
||||
'|FIRST_NAME: ' + user.first_name + '|LAST_NAME: ' + user.last_name + '|EMAIL: ' + user.email +
|
||||
') AFTER(' + '|NAME: ' + form.cleaned_data.get('username') +
|
||||
'|FIRST_NAME: ' + form.cleaned_data.get('first_name') + '|LAST_NAME: ' + form.cleaned_data.get(
|
||||
'last_name') + '|EMAIL: ' + form.cleaned_data.get('email') + ')'
|
||||
)
|
||||
|
||||
user.username = form.cleaned_data.get('username')
|
||||
user.first_name = form.cleaned_data.get('first_name')
|
||||
user.last_name = form.cleaned_data.get('last_name')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue