            var username = $(self.elements.username).val();
                var password = $(self.elements.password).val();
                var remember = $(self.elements.remember).is(':checked');
                var mechanism = $(self.elements.mechanism).val();
                doLogin(username, password, remember, mechanism)
                    .done(function(response, text, jqxhr) {
                        $(self).find('.login-error').slideUp();
                        $(self).trigger('submit', 'post');
 