doLogin: function () {
        var username = this.get('content.username'),
            password = this.get('content.password'),
            that = this;

        this.set('content.authenticating', true);
        this.set('content.errorMessage', '');
        App.authProvider.authenticateUser(this, username, password)
            .done(function (token) {
                App.authProvider.populateCurrentUser()
                    .done(function () {
                        window.location.href = '#/' + that.get('content.returnUri');
                    })
                    .fail(function (error) {
                        that.set('errors', [{ message: error }]);
                        that.set('content.authenticating', false);
                        that.set('content.password', '');
                    });
            })
            .fail(function (error) {
                that.set('errors', [{ message: error }]);
                that.set('content.authenticating', false);
                that.set('content.password', '');
            });
    }
 .done(function (token) {
     App.authProvider.populateCurrentUser()
         .done(function () {
             window.location.href = '#/' + that.get('content.returnUri');
         })
         .fail(function (error) {
             that.set('errors', [{ message: error }]);
             that.set('content.authenticating', false);
             that.set('content.password', '');
         });
 })
    error: function (err) {
        var sessionExpired = App.authProvider.isAccessTokenExpired();

        if (err) {
            App.ConfirmDialogView.confirm({
                title: sessionExpired ? 'Session Expired' : 'Error',
                body: sessionExpired ? 'Your session has been expired due to inactivity, please log in again.' : err.message,
                okButtonEnabled: false,
                acceptCallback: sessionExpired ? this.logout : this.refresh
            });
        }
    },