def deactivate(self, request):
        form = DeactivateProfileForm(request.form)

        if form.validate_on_submit():
            if not request.user.check_password(form.password.data):
                form.password.errors = [_(u'The password was not correct.')]
            else:
                user = request.user
                get_auth_system().logout(request)
                user.deactivate()
                db.session.commit()
                request.flash(_(u'Your profile was deactivated successfully'),
                     success=True)
                return redirect(href('portal/index'))

        return {
            'form': form
        }
 def register(self, request):
     return get_auth_system().register(request)
 def logout(self, request):
     return get_auth_system().logout(request)