<commit_before>'use strict';

(function () {
    var view = app.authenticationView = kendo.observable({
        onShow: function () {
            var shouldDisableAdfsButton = app.settings.social.adfs.endpoint === '$ADFS_ENDPOINT$' && app.settings.social.adfs.realm === '$ADFS_REALM$';
            if (shouldDisableAdfsButton) {
                $('#adfs-btn').prop('disabled', shouldDisableAdfsButton);
            }

            mode = 'signin'; //reset the view mode
            init();
        },
        afterShow: function () {
            provider.users.currentUser().then(successHandler, init)
        }
    });

    var provider = app.data.defaultProvider;
    var mode = 'signin';
    var registerRedirect = 'activitiesView';
    var signinRedirect = 'activitiesView';

    function init(error) {
        app.utils.loading(false);
        if (error) {
            app.notify.error(error);
            return false;
        }

        var activeView = mode === 'signin' ? '.signin-view' : '.signup-view';

        if (provider.setup && provider.setup.offlineStorage && !app.data.defaultProvider.isOnline()) {
            $('.offline').show().siblings().hide();
        } else {
            $(activeView).show().siblings().hide();
        }
    }

    function successHandler(data) {
        var redirect = mode === 'signin' ? signinRedirect : registerRedirect;

        if (data && data.result) {
            app.authentication.loadCachedAccessToken()
                .then(function () {
                    app.mobileApp.navigate('components/' + redirect + '/view.html');
                    app.utils.loading(false);
                });
        } else {
            init();
        }
    }

    var vm = kendo.observable({
        displayName: '',
        username: '',
        password: '',
        email: '',
        loginValidator: null,
        registerValidator: null,
        signin: function (username, password) {
            var model = vm;
            if (typeof username !== 'string') {
                username = model.username.toLowerCase();
            }

            if (typeof password !== 'string') {<commit_msg>fixed not being able to login if registered user with not only lowercase username<commit_after>'use strict';

(function () {
    var view = app.authenticationView = kendo.observable({
        onShow: function () {
            var shouldDisableAdfsButton = app.settings.social.adfs.endpoint === '$ADFS_ENDPOINT$' && app.settings.social.adfs.realm === '$ADFS_REALM$';
            if (shouldDisableAdfsButton) {
                $('#adfs-btn').prop('disabled', shouldDisableAdfsButton);
            }

            mode = 'signin'; //reset the view mode
            init();
        },
        afterShow: function () {
            provider.users.currentUser().then(successHandler, init)
        }
    });

    var provider = app.data.defaultProvider;
    var mode = 'signin';
    var registerRedirect = 'activitiesView';
    var signinRedirect = 'activitiesView';

    function init(error) {
        app.utils.loading(false);
        if (error) {
            app.notify.error(error);
            return false;
        }

        var activeView = mode === 'signin' ? '.signin-view' : '.signup-view';

        if (provider.setup && provider.setup.offlineStorage && !app.data.defaultProvider.isOnline()) {
            $('.offline').show().siblings().hide();
        } else {
            $(activeView).show().siblings().hide();
        }
    }

    function successHandler(data) {
        var redirect = mode === 'signin' ? signinRedirect : registerRedirect;

        if (data && data.result) {
            app.authentication.loadCachedAccessToken()
                .then(function () {
                    app.mobileApp.navigate('components/' + redirect + '/view.html');
                    app.utils.loading(false);
                });
        } else {
            init();
        }
    }

    var vm = kendo.observable({
        displayName: '',
        username: '',
        password: '',
        email: '',
        loginValidator: null,
        registerValidator: null,
        signin: function (username, password) {
            var model = vm;
            if (typeof username !== 'string') {
                username = model.username;
            }

            if (typeof password !== 'string') {
{'fraction_non_alphanumeric': 0.13827331486611266, 'fraction_numerical': 0.0, 'mean_word_length': 1.8487836949375411, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5624079', 'n_tokens_mistral': 1171, 'n_tokens_neox': 1142, 'n_words': 233}