<commit_before>(function() {
    "use strict";

    var app = angular.module('app.login', ['firebase.utils', 'firebase.auth', 'ngRoute']);

    app.controller('Login', ['$scope', 'Auth', '$location', 'fbutil', function($scope, Auth, $location, fbutil) {
        var vm = this;
        $scope.email = null;
        $scope.pass = null;
        $scope.confirm = null;
        $scope.createMode = false;

        $scope.login = function(email, pass) {
            $scope.err = null;
            Auth.$authWithPassword({ email: email, password: pass }, { rememberMe: true })
                .then(function(/* user */) {
                    $location.path('/account');
                }, function(err) {
                    $scope.err = errMessage(err);
                });
        };

        $scope.createAccount = function() {
            $scope.err = null;
            if (assertValidAccountProps()) {
                var email = $scope.email;
                var pass = $scope.pass;
                // create user credentials in Firebase auth system
                Auth.$createUser({ email: email, password: pass })
                    .then(function() {
                        // authenticate so we have permission to write to Firebase
                        return Auth.$authWithPassword({ email: email, password: <PASSWORD> });
                    })
                    .then(function(user) {
                        // create a user profile in our data store
                        var ref = fbutil.ref('users', user.uid);
                        return fbutil.handler(function(cb) {
                            ref.set({ email: email, name: name || firstPartOfEmail(email) }, cb);
                        });
                    })
                    .then(function(/* user */) {
                        // redirect to the account page
                        $location.path('/account');
                    }, function(err) {
                        $scope.err = errMessage(err);
                    });
            }
        };

        $scope.signInWithProvider = function(provider) {
            $scope.err = null;
            Auth.$authWithOAuthPopup(provider, function(error, authData) {
                if (error) {
                    $scope.err = errMessage(error);
                } else {
                    $location.path('/account');
                }
            });
        }

        $scope.signInAsGuest = function() {
            $scope.err = null;
            Auth.$authAnonymously(function(error) {
                if (error) {
                    $scope.err = errMessage(error);
                } else {
                    $location.path('/account');
                }
            });
        }

        $scope.callPhone = function() {
            window.location.href = 'tel:+61406522097';
        }

        $scope.sendSms = function() {
            window.location.href = 'sms:+61406522097';
        }

        function assertValidAccountProps() {
            if (!$scope.email) {
                $scope.err = 'Please enter an email address';
            }
            else if (!$scope.pass || !$scope.confirm) {
                $scope.err = 'Please enter a password';
            }
            else if ($scope.createMode && $scope.pass !== $scope.confirm) {
                $scope.err = 'Passwords do not match';
            }
            return !$scope.err;
        }

        function errMessage(err) {
            return angular.isObject(err) && err.code ? err.code : err + '';
        }

        function firstPartOfEmail(email) {
            return ucfirst(email.substr(0, email.indexOf('@')) || '');
        }

        function ucfirst(str) {
            // inspired by: http://kevin.vanzonneveld.net
            str += '';
            var f = str.charAt(0).toUpperCase();
            return f + str.substr(1);
        }
    }]);
    
    app.config(['$routeProvider', function($routeProvider) {
        $routeProvider.when('/login', {
            templateUrl: 'login/login.html',
            controller: 'Login',
            resolve: {
                // forces the page to wait for this promise to resolve before controller is loaded
                // the controller can then inject `user` as a dependency. This could also be done
                // in the controller, but this makes things cleaner (controller doesn't need to worry
                // about auth status or timing of accessing data or displaying elements)
                user: ['Auth', function(Auth) {
                    return Auth.$waitForAuth();
                }]
            }
        });
    }]);

})();<commit_msg>removed unused login with password<commit_after>(function() {
    "use strict";

    var app = angular.module('app.login', ['firebase.utils', 'firebase.auth', 'ngRoute']);

    app.controller('Login', ['$scope', 'Auth', '$location', 'fbutil', function($scope, Auth, $location, fbutil) {
        var vm = this;
        $scope.email = null;
        $scope.pass = null;
        $scope.confirm = null;
        $scope.createMode = false;

        $scope.signInWithProvider = function(provider) {
            $scope.err = null;
            Auth.$authWithOAuthPopup(provider, function(error, authData) {
                if (error) {
                    $scope.err = errMessage(error);
                } else {
                    $location.path('/account');
                }
            });
        }

        $scope.signInAsGuest = function() {
            $scope.err = null;
            Auth.$authAnonymously(function(error) {
                if (error) {
                    $scope.err = errMessage(error);
                } else {
                    $location.path('/account');
                }
            });
        }

        $scope.callPhone = function() {
            window.location.href = 'tel:+61406522097';
        }

        $scope.sendSms = function() {
            window.location.href = 'sms:+61406522097';
        }

        function errMessage(err) {
            return angular.isObject(err) && err.code ? err.code : err + '';
        }

    }]);
    
    app.config(['$routeProvider', function($routeProvider) {
        $routeProvider.when('/login', {
            templateUrl: 'login/login.html',
            controller: 'Login',
            resolve: {
                // forces the page to wait for this promise to resolve before controller is loaded
                // the controller can then inject `user` as a dependency. This could also be done
                // in the controller, but this makes things cleaner (controller doesn't need to worry
                // about auth status or timing of accessing data or displaying elements)
                user: ['Auth', function(Auth) {
                    return Auth.$waitForAuth();
                }]
            }
        });
    }]);

})();
{'fraction_non_alphanumeric': 0.12656934306569342, 'fraction_numerical': 0.006861313868613139, 'mean_word_length': 1.3996497373029773, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '7085253', 'n_tokens_mistral': 1808, 'n_tokens_neox': 1691, 'n_words': 409}