- def fugue_icons(self):
- return ['user-silhouette', 'key--pencil', 'door-open-out', 'door-open-in']
-
- @gilbert_method(restricted=False)
- def login(self, request, username, password):
- user = authenticate(username=username, password=password)
- if user is not None and user.is_active:
- login(request, user)
- return True
- else:
- return False
-
- @gilbert_method
- def logout(self, request):
- logout(request)
- return True
-
- @gilbert_method
- def get_passwd_form(self, request):
- from django.contrib.auth.forms import PasswordChangeForm
- return PasswordChangeForm(request.user).as_ext()
-
- @gilbert_method(form_handler=True)
- def submit_passwd_form(self, request):
- from django.contrib.auth.forms import PasswordChangeForm
- form = PasswordChangeForm(request.user, data=request.POST)
- if form.is_valid():
- form.save()
- return {'success': True}
- else:
- return {'success': False, 'errors': form.errors}