Commit 14083b9e08b543980588328e62b25b4b52d1742a
1 parent
d0923db7
Exists in
master
and in
2 other branches
Fixing bugs involving password in users module and image related in user deletion
Showing
29 changed files
with
153 additions
and
124 deletions
Show diff stats
amadeus/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-08-23 23:53-0300\n" | |
11 | +"POT-Creation-Date: 2017-08-27 21:08-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
analytics/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-08-23 23:53-0300\n" | |
11 | +"POT-Creation-Date: 2017-08-27 21:08-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
api/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-08-23 23:53-0300\n" | |
11 | +"POT-Creation-Date: 2017-08-27 21:08-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
bulletin/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-08-23 23:53-0300\n" | |
11 | +"POT-Creation-Date: 2017-08-27 21:08-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
categories/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-08-23 23:53-0300\n" | |
11 | +"POT-Creation-Date: 2017-08-27 21:08-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
chat/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-08-23 23:53-0300\n" | |
11 | +"POT-Creation-Date: 2017-08-27 21:08-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
dashboards/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-08-23 23:53-0300\n" | |
11 | +"POT-Creation-Date: 2017-08-27 21:08-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
file_link/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-08-23 23:53-0300\n" | |
11 | +"POT-Creation-Date: 2017-08-27 21:08-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
goals/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-08-23 23:53-0300\n" | |
11 | +"POT-Creation-Date: 2017-08-27 21:08-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
links/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-08-23 23:53-0300\n" | |
11 | +"POT-Creation-Date: 2017-08-27 21:08-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
log/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-08-23 23:53-0300\n" | |
11 | +"POT-Creation-Date: 2017-08-27 21:08-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
mailsender/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-08-23 23:53-0300\n" | |
11 | +"POT-Creation-Date: 2017-08-27 21:08-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
mural/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-08-23 23:53-0300\n" | |
11 | +"POT-Creation-Date: 2017-08-27 21:08-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
news/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-08-23 23:53-0300\n" | |
11 | +"POT-Creation-Date: 2017-08-27 21:08-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
notifications/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-08-23 23:53-0300\n" | |
11 | +"POT-Creation-Date: 2017-08-27 21:08-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
pdf_file/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-08-23 23:53-0300\n" | |
11 | +"POT-Creation-Date: 2017-08-27 21:08-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
pendencies/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-08-23 23:53-0300\n" | |
11 | +"POT-Creation-Date: 2017-08-27 21:08-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
reports/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-08-23 23:53-0300\n" | |
11 | +"POT-Creation-Date: 2017-08-27 21:08-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
security/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-08-23 23:53-0300\n" | |
11 | +"POT-Creation-Date: 2017-08-27 21:08-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
students_group/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-08-23 23:53-0300\n" | |
11 | +"POT-Creation-Date: 2017-08-27 21:08-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
subjects/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-08-23 23:53-0300\n" | |
11 | +"POT-Creation-Date: 2017-08-27 21:08-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
themes/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-08-23 23:53-0300\n" | |
11 | +"POT-Creation-Date: 2017-08-27 21:08-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
topics/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-08-23 23:53-0300\n" | |
11 | +"POT-Creation-Date: 2017-08-27 21:08-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" |
... | ... | @@ -18,11 +18,11 @@ msgstr "" |
18 | 18 | "Content-Transfer-Encoding: 8bit\n" |
19 | 19 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" |
20 | 20 | |
21 | -#: topics/forms.py:28 | |
21 | +#: topics/forms.py:30 topics/forms.py:47 | |
22 | 22 | msgid "This subject already has a repository" |
23 | 23 | msgstr "Esse assunto já possui um repositório" |
24 | 24 | |
25 | -#: topics/forms.py:30 | |
25 | +#: topics/forms.py:49 | |
26 | 26 | msgid "This subject already has a topic with this name" |
27 | 27 | msgstr "Esse assunto já possui um tópico com esse nome" |
28 | 28 | ... | ... |
users/forms.py
... | ... | @@ -46,72 +46,89 @@ class Validation(forms.ModelForm): |
46 | 46 | |
47 | 47 | return image |
48 | 48 | |
49 | - def clean_password2(self): | |
50 | - password = self.cleaned_data.get("new_password") | |
51 | - password2 = self.cleaned_data.get("password2") | |
49 | + def clean_new_password(self): | |
50 | + password = self.cleaned_data.get('new_password') | |
51 | + | |
52 | + if self.is_edit and len(password) == 0: | |
53 | + return password | |
52 | 54 | |
53 | - if password and password2 and password != password2: | |
54 | - self._errors['password2'] = [_('The confirmation password is incorrect.')] | |
55 | + if len(password) == 0: | |
56 | + self._errors['new_password'] = [_('You must define a password.')] | |
55 | 57 | |
56 | 58 | return ValueError |
57 | 59 | |
60 | + return password | |
61 | + | |
62 | + def clean_password2(self): | |
63 | + password = self.cleaned_data.get("new_password", None) | |
64 | + password2 = self.cleaned_data.get("password2", None) | |
65 | + | |
66 | + if self.is_edit and len(password) == 0: | |
67 | + return password2 | |
68 | + | |
69 | + if not password is None and password != ValueError: | |
70 | + if not password2 is None and password != password2: | |
71 | + self._errors['password2'] = [_('The confirmation password is incorrect.')] | |
72 | + | |
73 | + return ValueError | |
74 | + | |
58 | 75 | return password2 |
59 | 76 | |
60 | 77 | class RegisterUserForm(Validation): |
61 | - new_password = forms.CharField(label=_('Password'), widget = forms.PasswordInput(render_value = True, attrs = {'placeholder': _('Password *')})) | |
62 | - password2 = forms.CharField(label = _('Confirm Password'), widget = forms.PasswordInput(render_value = True, attrs = {'placeholder': _('Confirm Password *')})) | |
78 | + new_password = forms.CharField(label=_('Password'), widget = forms.PasswordInput(render_value = True, attrs = {'placeholder': _('Password *')})) | |
79 | + password2 = forms.CharField(label = _('Confirm Password'), widget = forms.PasswordInput(render_value = True, attrs = {'placeholder': _('Confirm Password *')})) | |
63 | 80 | |
64 | - is_edit = False | |
81 | + is_edit = False | |
65 | 82 | |
66 | 83 | #Cropping image |
67 | - x = forms.FloatField(widget=forms.HiddenInput(),required=False) | |
68 | - y = forms.FloatField(widget=forms.HiddenInput(),required=False) | |
69 | - width = forms.FloatField(widget=forms.HiddenInput(),required=False) | |
70 | - height = forms.FloatField(widget=forms.HiddenInput(),required=False) | |
71 | - | |
72 | - | |
73 | - def save(self, commit=True): | |
74 | - super(RegisterUserForm, self).save(commit=False) | |
75 | - self.deletepath = "" | |
76 | - | |
77 | - x = self.cleaned_data.get('x') | |
78 | - y = self.cleaned_data.get('y') | |
79 | - w = self.cleaned_data.get('width') | |
80 | - h = self.cleaned_data.get('height') | |
81 | - | |
82 | - if self.instance.image : | |
83 | - image = Image.open(self.instance.image) | |
84 | - if not x is None: | |
85 | - cropped_image = image.crop((x, y, w+x, h+y)) | |
86 | - resized_image = cropped_image.resize((200, 200), Image.ANTIALIAS) | |
87 | - | |
88 | - folder_path = join(settings.MEDIA_ROOT, 'users') | |
89 | - #check if the folder already exists | |
90 | - if not os.path.isdir(folder_path): | |
91 | - os.makedirs(folder_path) | |
92 | - | |
93 | - if ("users" not in self.instance.image.path): | |
94 | - self.deletepath = self.instance.image.path | |
95 | - | |
96 | - resized_image.save(self.instance.image.path) | |
97 | - | |
98 | - self.instance.set_password(self.cleaned_data['new_password']) | |
99 | - | |
100 | - self.instance.save() | |
101 | - if (self.deletepath): | |
102 | - os.remove(self.deletepath) | |
103 | - return self.instance | |
104 | - | |
105 | - class Meta: | |
106 | - model = User | |
107 | - fields = ['email', 'username', 'last_name', 'social_name', 'image', 'show_email', 'x', 'y', 'width', 'height',] | |
108 | - widgets = { | |
109 | - 'email': forms.EmailInput(attrs = {'placeholder': _('Email *')}), | |
110 | - 'username': forms.TextInput(attrs = {'placeholder': _('Name *')}), | |
111 | - 'last_name': forms.TextInput(attrs = {'placeholder': _('Last Name *')}), | |
112 | - 'social_name': forms.TextInput(attrs = {'placeholder': _('Social Name')}), | |
84 | + x = forms.FloatField(widget=forms.HiddenInput(),required=False) | |
85 | + y = forms.FloatField(widget=forms.HiddenInput(),required=False) | |
86 | + width = forms.FloatField(widget=forms.HiddenInput(),required=False) | |
87 | + height = forms.FloatField(widget=forms.HiddenInput(),required=False) | |
88 | + | |
89 | + | |
90 | + def save(self, commit=True): | |
91 | + super(RegisterUserForm, self).save(commit=False) | |
92 | + self.deletepath = "" | |
93 | + | |
94 | + x = self.cleaned_data.get('x') | |
95 | + y = self.cleaned_data.get('y') | |
96 | + w = self.cleaned_data.get('width') | |
97 | + h = self.cleaned_data.get('height') | |
98 | + | |
99 | + if self.instance.image : | |
100 | + image = Image.open(self.instance.image) | |
101 | + if not x is None: | |
102 | + cropped_image = image.crop((x, y, w+x, h+y)) | |
103 | + resized_image = cropped_image.resize((200, 200), Image.ANTIALIAS) | |
104 | + | |
105 | + folder_path = join(settings.MEDIA_ROOT, 'users') | |
106 | + #check if the folder already exists | |
107 | + if not os.path.isdir(folder_path): | |
108 | + os.makedirs(folder_path) | |
109 | + | |
110 | + if ("users" not in self.instance.image.path): | |
111 | + self.deletepath = self.instance.image.path | |
112 | + | |
113 | + resized_image.save(self.instance.image.path) | |
114 | + | |
115 | + self.instance.set_password(self.cleaned_data['new_password']) | |
116 | + | |
117 | + self.instance.save() | |
118 | + if (self.deletepath): | |
119 | + os.remove(self.deletepath) | |
120 | + return self.instance | |
121 | + | |
122 | + class Meta: | |
123 | + model = User | |
124 | + fields = ['email', 'username', 'last_name', 'social_name', 'image', 'show_email', 'x', 'y', 'width', 'height',] | |
125 | + widgets = { | |
126 | + 'email': forms.EmailInput(attrs = {'placeholder': _('Email *')}), | |
127 | + 'username': forms.TextInput(attrs = {'placeholder': _('Name *')}), | |
128 | + 'last_name': forms.TextInput(attrs = {'placeholder': _('Last Name *')}), | |
129 | + 'social_name': forms.TextInput(attrs = {'placeholder': _('Social Name')}), | |
113 | 130 | 'image': ResubmitFileWidget(attrs={'accept':'image/*'}), |
114 | - } | |
131 | + } | |
115 | 132 | |
116 | 133 | class ProfileForm(Validation): |
117 | 134 | is_edit = True |
... | ... | @@ -137,7 +154,7 @@ class ProfileForm(Validation): |
137 | 154 | resized_image = cropped_image.resize((200, 200), Image.ANTIALIAS) |
138 | 155 | |
139 | 156 | folder_path = join(settings.MEDIA_ROOT, 'users') |
140 | - #check if the folder already exists | |
157 | + #check if the folder already exists | |
141 | 158 | if not os.path.isdir(folder_path): |
142 | 159 | os.makedirs(folder_path) |
143 | 160 | |
... | ... | @@ -148,7 +165,7 @@ class ProfileForm(Validation): |
148 | 165 | |
149 | 166 | self.instance.save() |
150 | 167 | if (self.deletepath): |
151 | - os.remove(self.deletepath) | |
168 | + os.remove(self.deletepath) | |
152 | 169 | return self.instance |
153 | 170 | |
154 | 171 | class Meta: |
... | ... | @@ -197,7 +214,7 @@ class UserForm(Validation): |
197 | 214 | resized_image = cropped_image.resize((200, 200), Image.ANTIALIAS) |
198 | 215 | |
199 | 216 | folder_path = join(settings.MEDIA_ROOT, 'users') |
200 | - #check if the folder already exists | |
217 | + #check if the folder already exists | |
201 | 218 | if not os.path.isdir(folder_path): |
202 | 219 | os.makedirs(folder_path) |
203 | 220 | ... | ... |
users/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-08-23 23:53-0300\n" | |
11 | +"POT-Creation-Date: 2017-08-27 21:08-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" |
... | ... | @@ -18,7 +18,7 @@ msgstr "" |
18 | 18 | "Content-Transfer-Encoding: 8bit\n" |
19 | 19 | "Plural-Forms: nplurals=2; plural=(n > 1);\n" |
20 | 20 | |
21 | -#: users/forms.py:28 users/forms.py:33 users/forms.py:279 | |
21 | +#: users/forms.py:28 users/forms.py:33 users/forms.py:296 | |
22 | 22 | msgid "You must insert an email address" |
23 | 23 | msgstr "Você deve inserir um endereço de email" |
24 | 24 | |
... | ... | @@ -26,60 +26,64 @@ msgstr "Você deve inserir um endereço de email" |
26 | 26 | msgid "The image is too large. It should have less than 2MB." |
27 | 27 | msgstr "A imagem é muito grande. Ela deve conter menos de 2MB." |
28 | 28 | |
29 | -#: users/forms.py:54 | |
29 | +#: users/forms.py:56 | |
30 | +msgid "You must define a password." | |
31 | +msgstr "Você deve definir uma senha." | |
32 | + | |
33 | +#: users/forms.py:71 | |
30 | 34 | msgid "The confirmation password is incorrect." |
31 | 35 | msgstr "A confirmação de senha está incorreta." |
32 | 36 | |
33 | -#: users/forms.py:61 users/forms.py:175 users/templates/users/login.html:52 | |
37 | +#: users/forms.py:78 users/forms.py:192 users/templates/users/login.html:52 | |
34 | 38 | msgid "Password" |
35 | 39 | msgstr "Senha" |
36 | 40 | |
37 | -#: users/forms.py:61 | |
41 | +#: users/forms.py:78 | |
38 | 42 | msgid "Password *" |
39 | 43 | msgstr "Senha *" |
40 | 44 | |
41 | -#: users/forms.py:62 users/forms.py:176 users/forms.py:236 users/forms.py:292 | |
45 | +#: users/forms.py:79 users/forms.py:193 users/forms.py:253 users/forms.py:309 | |
42 | 46 | msgid "Confirm Password" |
43 | 47 | msgstr "Confirmação de Senha" |
44 | 48 | |
45 | -#: users/forms.py:62 | |
49 | +#: users/forms.py:79 | |
46 | 50 | msgid "Confirm Password *" |
47 | 51 | msgstr "Confirmação de Senha *" |
48 | 52 | |
49 | -#: users/forms.py:109 | |
53 | +#: users/forms.py:126 | |
50 | 54 | msgid "Email *" |
51 | 55 | msgstr "Email *" |
52 | 56 | |
53 | -#: users/forms.py:110 | |
57 | +#: users/forms.py:127 | |
54 | 58 | msgid "Name *" |
55 | 59 | msgstr "Nome *" |
56 | 60 | |
57 | -#: users/forms.py:111 | |
61 | +#: users/forms.py:128 | |
58 | 62 | msgid "Last Name *" |
59 | 63 | msgstr "Sobrenome *" |
60 | 64 | |
61 | -#: users/forms.py:112 users/models.py:31 | |
65 | +#: users/forms.py:129 users/models.py:31 | |
62 | 66 | msgid "Social Name" |
63 | 67 | msgstr "Nome Social" |
64 | 68 | |
65 | -#: users/forms.py:235 users/forms.py:291 | |
69 | +#: users/forms.py:252 users/forms.py:308 | |
66 | 70 | msgid "New Password" |
67 | 71 | msgstr "Nova Senha" |
68 | 72 | |
69 | -#: users/forms.py:242 | |
73 | +#: users/forms.py:259 | |
70 | 74 | msgid "The value inputed does not match with your actual password." |
71 | 75 | msgstr "O valor inserido não corresponde à sua senha atual." |
72 | 76 | |
73 | -#: users/forms.py:263 | |
77 | +#: users/forms.py:280 | |
74 | 78 | msgid "Actual Password" |
75 | 79 | msgstr "Senha Atual" |
76 | 80 | |
77 | -#: users/forms.py:270 users/templates/users/list.html:56 | |
81 | +#: users/forms.py:287 users/templates/users/list.html:56 | |
78 | 82 | #: users/templates/users/login.html:47 users/templates/users/search.html:47 |
79 | 83 | msgid "Email" |
80 | 84 | msgstr "Email" |
81 | 85 | |
82 | -#: users/forms.py:284 | |
86 | +#: users/forms.py:301 | |
83 | 87 | msgid "You must insert a valid email address" |
84 | 88 | msgstr "Você deve inserir um endereço de email válido" |
85 | 89 | |
... | ... | @@ -200,7 +204,7 @@ msgstr "Deletar" |
200 | 204 | msgid "Are you sure you want delete your account?" |
201 | 205 | msgstr "Tem certeza que deseja deletar sua conta?" |
202 | 206 | |
203 | -#: users/templates/users/forgot_password.html:39 users/views.py:391 | |
207 | +#: users/templates/users/forgot_password.html:39 users/views.py:399 | |
204 | 208 | msgid "Forgot Password" |
205 | 209 | msgstr "Esqueceu Senha" |
206 | 210 | |
... | ... | @@ -251,7 +255,7 @@ msgstr "Entre com a sua conta para continuar" |
251 | 255 | msgid "Log in" |
252 | 256 | msgstr "Entrar" |
253 | 257 | |
254 | -#: users/templates/users/login.html:66 users/views.py:365 | |
258 | +#: users/templates/users/login.html:66 users/views.py:373 | |
255 | 259 | msgid "Sign Up" |
256 | 260 | msgstr "Cadastrar" |
257 | 261 | |
... | ... | @@ -349,39 +353,39 @@ msgstr "" |
349 | 353 | "Não é possível deletar a conta. O usuário está vinculado com uma ou mais " |
350 | 354 | "funções (administrador, coordenador, professor ou estudante) no sistema." |
351 | 355 | |
352 | -#: users/views.py:259 | |
356 | +#: users/views.py:267 | |
353 | 357 | msgid "Delete Account" |
354 | 358 | msgstr "Remover Conta" |
355 | 359 | |
356 | -#: users/views.py:303 | |
360 | +#: users/views.py:311 | |
357 | 361 | msgid "Password changed successfully!" |
358 | 362 | msgstr "Senha alterada com sucesso!" |
359 | 363 | |
360 | -#: users/views.py:309 | |
364 | +#: users/views.py:317 | |
361 | 365 | msgid "Change Password" |
362 | 366 | msgstr "Alterar Senha" |
363 | 367 | |
364 | -#: users/views.py:327 | |
368 | +#: users/views.py:335 | |
365 | 369 | msgid "Profile" |
366 | 370 | msgstr "Perfil" |
367 | 371 | |
368 | -#: users/views.py:346 | |
372 | +#: users/views.py:354 | |
369 | 373 | msgid "Update Profile" |
370 | 374 | msgstr "Atualizar Perfil" |
371 | 375 | |
372 | -#: users/views.py:352 | |
376 | +#: users/views.py:360 | |
373 | 377 | msgid "Profile edited successfully!" |
374 | 378 | msgstr "Perfil editado com sucesso!" |
375 | 379 | |
376 | -#: users/views.py:372 | |
380 | +#: users/views.py:380 | |
377 | 381 | msgid "User successfully registered!" |
378 | 382 | msgstr "Usuário cadastrado com sucesso!" |
379 | 383 | |
380 | -#: users/views.py:410 | |
384 | +#: users/views.py:418 | |
381 | 385 | msgid "Recover Password" |
382 | 386 | msgstr "Recuperar Senha" |
383 | 387 | |
384 | -#: users/views.py:446 | |
388 | +#: users/views.py:454 | |
385 | 389 | msgid "" |
386 | 390 | "Soon you'll receive an email with instructions to set your new password. If " |
387 | 391 | "you don't receive it in 24 hours, please check your spam box." |
... | ... | @@ -389,34 +393,34 @@ msgstr "" |
389 | 393 | "Em breve você receberá um email com instruções para cadastrar sua nova " |
390 | 394 | "senha. Se você não recebê-lo em 24 hhoras, por favor olhe sua caixa de spam." |
391 | 395 | |
392 | -#: users/views.py:449 | |
396 | +#: users/views.py:457 | |
393 | 397 | msgid "No user is associated with this email address" |
394 | 398 | msgstr "Nenhum usuário associado com esse endereço de email." |
395 | 399 | |
396 | -#: users/views.py:462 | |
400 | +#: users/views.py:470 | |
397 | 401 | msgid "Reset Password" |
398 | 402 | msgstr "Recuperar Senha" |
399 | 403 | |
400 | -#: users/views.py:484 | |
404 | +#: users/views.py:492 | |
401 | 405 | msgid "Password reset successfully." |
402 | 406 | msgstr "Senha alterada com sucesso!" |
403 | 407 | |
404 | -#: users/views.py:488 | |
408 | +#: users/views.py:496 | |
405 | 409 | msgid "We were not able to reset your password." |
406 | 410 | msgstr "Não foi possível restaurar sua senha" |
407 | 411 | |
408 | -#: users/views.py:491 | |
412 | +#: users/views.py:499 | |
409 | 413 | msgid "The reset password link is no longer valid." |
410 | 414 | msgstr "O link para restaurar senha não está mais válido." |
411 | 415 | |
412 | -#: users/views.py:497 | |
416 | +#: users/views.py:505 | |
413 | 417 | msgid "Log In" |
414 | 418 | msgstr "Entrar" |
415 | 419 | |
416 | -#: users/views.py:533 | |
420 | +#: users/views.py:541 | |
417 | 421 | msgid "System under maintenance. Try again later" |
418 | 422 | msgstr "Sistema em manutenção. Tente novamente mais tarde" |
419 | 423 | |
420 | -#: users/views.py:535 | |
424 | +#: users/views.py:543 | |
421 | 425 | msgid "E-mail or password are incorrect." |
422 | 426 | msgstr "Email ou senha incorretos." | ... | ... |
users/views.py
... | ... | @@ -242,12 +242,20 @@ class DeleteView(braces_mixins.LoginRequiredMixin, LogMixin, generic.DeleteView) |
242 | 242 | redirect_url = redirect(error_url) |
243 | 243 | else: |
244 | 244 | self.log_context['dependencies'] = False |
245 | - image_path_to_delete = user.image.path | |
245 | + | |
246 | + if user.image: | |
247 | + image_path_to_delete = user.image.path | |
248 | + else: | |
249 | + image_path_to_delete = None | |
250 | + | |
246 | 251 | user.delete() |
247 | 252 | |
248 | 253 | messages.success(self.request, success_msg) |
249 | - #deleting the user image | |
250 | - os.remove(image_path_to_delete) | |
254 | + | |
255 | + if not image_path_to_delete is None: | |
256 | + #deleting the user image | |
257 | + os.remove(image_path_to_delete) | |
258 | + | |
251 | 259 | redirect_url = redirect(success_url) |
252 | 260 | |
253 | 261 | super(DeleteView, self).createLog(self.request.user, self.log_component, self.log_action, self.log_resource, self.log_context) | ... | ... |
webconference/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-08-23 23:53-0300\n" | |
11 | +"POT-Creation-Date: 2017-08-27 21:08-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
webpage/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-08-23 23:53-0300\n" | |
11 | +"POT-Creation-Date: 2017-08-27 21:08-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |
youtube_video/locale/pt_BR/LC_MESSAGES/django.po
... | ... | @@ -8,7 +8,7 @@ msgid "" |
8 | 8 | msgstr "" |
9 | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
10 | 10 | "Report-Msgid-Bugs-To: \n" |
11 | -"POT-Creation-Date: 2017-08-23 23:53-0300\n" | |
11 | +"POT-Creation-Date: 2017-08-27 21:08-0300\n" | |
12 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
13 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
14 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | ... | ... |