Merge branch 'gilbert' into gilbert-1.3
[philo.git] / contrib / gilbert / plugins / auth.py
index e964559..d0c514b 100644 (file)
@@ -1,6 +1,6 @@
+from django.conf import settings
 from django.contrib.auth import logout
 from django.contrib.auth.forms import PasswordChangeForm
-import staticmedia
 from .base import Plugin
 from ..extdirect import ext_action, ext_method
 from ..models import UserPreferences
@@ -11,14 +11,14 @@ class Auth(Plugin):
        @property
        def index_js_urls(self):
                return super(Auth, self).index_js_urls + [
-                       staticmedia.url('gilbert/plugins/auth.js'),
+                       settings.STATIC_URL + 'gilbert/plugins/auth.js',
                ]
        
        @property
        def icon_names(self):
                return super(Auth, self).icon_names + [
                        'user-silhouette',
-                       'switch',
+                       'mask',
                        'key--pencil',
                        'door-open-out',
                ]
@@ -40,10 +40,10 @@ class Auth(Plugin):
        @ext_method(form_handler=True)
        def save_passwd_form(self, request):
                form = PasswordChangeForm(request.user, data=request.POST)
-               try:
+               if form.is_valid():
                        form.save()
                        return True, None
-               except:
+               else:
                        return False, form.errors
        
        @ext_method