Skip to content

Commit

Permalink
Merge pull request #173 from colab/update_user_info
Browse files Browse the repository at this point in the history
Update user info
  • Loading branch information
GustJc committed May 10, 2016
2 parents 8695780 + 8389dd7 commit a0b13d6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
14 changes: 13 additions & 1 deletion colab/accounts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
from django.utils.crypto import get_random_string
from django.utils.translation import ugettext_lazy as _

from .signals import user_created, user_password_changed
from .signals import (user_created, user_password_changed,
user_basic_info_updated)
from .utils import mailman


Expand Down Expand Up @@ -72,10 +73,21 @@ def update_subscription(self, email, lists):

def save(self, *args, **kwargs):

# verify if primary email was updated
current_user = User.objects.filter(pk=self.pk).first()
update_email = False

if current_user and current_user.email != self.email:
update_email = True

# Forces username to be lowercase always
self.username = self.username.lower()

super(User, self).save(*args, **kwargs)

user_basic_info_updated.send(User, user=self,
update_email=update_email)

def set_password(self, raw_password):
super(User, self).set_password(raw_password)
if self.pk:
Expand Down
1 change: 1 addition & 0 deletions colab/accounts/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@

user_created = Signal(providing_args=['user', 'password'])
user_password_changed = Signal(providing_args=['user', 'password'])
user_basic_info_updated = Signal(providing_args=['user', 'update_email'])
2 changes: 1 addition & 1 deletion colab/accounts/templates/accounts/user_update_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ <h3 class="panel-title">{% trans "Emails" %}</h3>
</div>
</div>
</div>
<div class="col-lg-4 col-md-5 col-sm-12 col-xm-12">
<div id="password_container" class="col-lg-4 col-md-5 col-sm-12 col-xm-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
Expand Down
4 changes: 4 additions & 0 deletions colab/static/css/screen.css
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ div.submit {

/* User profile */

#password_container {
float: right
}

.colab-vcard {
min-height: 400px;
}
Expand Down

0 comments on commit a0b13d6

Please sign in to comment.