Skip to content

Commit

Permalink
don't ask for password when adding users
Browse files Browse the repository at this point in the history
  • Loading branch information
bdzim committed May 19, 2014
1 parent 2a144a2 commit 89ddad9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ <h2 class="page-header"><i class="ss-icon">&#x1F464;</i>Add User
</div>
</div>
{% endcomment %}
{% if config.enable_local_users %}
<div class="widget-add-user" style="display:none">
<form action="{% url 'blue_mgnt:users' %}" enctype="multipart/form-data" method="POST">
{% csrf_token %}
Expand Down Expand Up @@ -61,7 +60,6 @@ <h2 class="page-header"><i class="ss-icon">&#x1F464;</i>Add User
</div>
</form>
</div>
{% endif %}
<div class="widget-upload-csv" style="display: none">
<form action="{% url 'blue_mgnt:users' %}" enctype="multipart/form-data" method="post">
{% csrf_token %}
Expand Down Expand Up @@ -91,10 +89,10 @@ <h2 class="page-header"><i class="ss-icon">&#x1F464;</i>Add User
</table>
<div class="csv-note">
<p>Note: CSV uploads should be comma delimited and need to contain
email address, name, password, and group name which should appear as follows:</p>
email address, name, and group name which should appear as follows:</p>
<p>
<pre>email,name,password,group_name
[email protected],Jane Doe,passworD,Local 20 GB</pre>
<pre>email,name,group_name
[email protected],Jane Doe,Unlimited</pre>
</p>
<p>For additional information, please don't hesitate to reach out to
<a href="mailto:[email protected]">[email protected]</a></p>
Expand Down
13 changes: 1 addition & 12 deletions django/apps/blue_management/blue_mgnt/views/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,6 @@ def clean_csv_file(self):
raise forms.ValidationError(msg + ' email is required')
if 'name' not in row:
raise forms.ValidationError(msg + ' name is required')
if 'password' not in row:
raise forms.ValidationError(msg + ' password is required')
if 'group_name' not in row:
raise forms.ValidationError(msg + ' group_name is required')

Expand All @@ -130,8 +128,6 @@ def clean_csv_file(self):
)
try:
api.create_user(user_info)
local_source.set_user_password(local_source._get_db_conn(config),
row['email'], row['password'])
log_admin_action(request, 'create user through csv: %s' % user_info)
except api.DuplicateEmail:
msg = 'Invalid data in row %s. Email already in use' % x
Expand All @@ -145,9 +141,6 @@ class NewUserForm(forms.Form):
username = forms.CharField(max_length=45)
email = forms.EmailField()
name = forms.CharField(max_length=45)
password = forms.CharField(max_length=64,
required=False,
widget=forms.PasswordInput)
group_id = forms.ChoiceField(local_groups, label='Group')

def clean_username(self):
Expand All @@ -165,7 +158,6 @@ def clean(self):
name = cleaned_data.get('name', '')
group_id = cleaned_data['group_id']
username = cleaned_data.get('username', '')
password = cleaned_data.get('password', '')

valid_username = username
if not hasattr(self, username):
Expand All @@ -178,10 +170,7 @@ def clean(self):
data.update(dict(username=username))
try:
api.create_user(data)
local_source.set_user_password(local_source._get_db_conn(config),
email, password)
if not password:
api.send_activation_email(email, dict(template_name='set_password'))
api.send_activation_email(email, dict(template_name='set_password'))
log_admin_action(request, 'create user: %s' % data)
except api.DuplicateEmail:
self._errors['email'] = self.error_class(["Email address already in use"])
Expand Down

0 comments on commit 89ddad9

Please sign in to comment.