<commit_before><!DOCTYPE html>
<!--
Copyright (c) 2016 Google Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html>
<head>
  <meta charset=utf-8 />
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Phone Authentication with Popup</title>

  <!-- Material Design Theming -->
  <link rel="stylesheet" href="https://code.getmdl.io/1.1.3/material.orange-indigo.min.css">
  <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
  <script defer src="https://code.getmdl.io/1.1.3/material.min.js"></script>

  <link rel="stylesheet" href="main.css">

  <!-- Import and configure the Firebase SDK -->
  <!-- These scripts are made available when the app is served or deployed on Firebase Hosting -->
  <!-- If you do not serve/host your project using Firebase Hosting see https://firebase.google.com/docs/web/setup -->
  <script src="https://www.gstatic.com/firebasejs/staging/4.0.0/firebase.js"></script> <!-- TODO: REMOVE before launch
  <script src="/__/firebase/4.0.0/firebase-app.js"></script>
  <script src="/__/firebase/4.0.0/firebase-auth.js"></script>
  -->
  <script src="/__/firebase/init.js"></script>

  <script type="text/javascript">

    /**
     * Function called when clicking the Login/Logout button.
     */
    function toggleSignIn(e) {
      e.preventDefault();
      document.getElementById('sign-in-button').disabled = true;
      if (!firebase.auth().currentUser) {
        // [START signin]
        var phoneNumber = getPhoneNumberFromUserInput();
        var appVerifier = window.recaptchaVerifier;
        firebase.auth().signInWithPhoneNumber(phoneNumber, appVerifier)
            .then(function(confirmationResult) {
              // SMS sent. Prompt user to type the code from the message, then sign the
              // user in with confirmationResult.confirm(code).
              // [START_EXCLUDE]
              document.getElementById('verification-code-form').style.display = 'block';
              document.getElementById('verify-code-button').disabled = false;
              // [END_EXCLUDE]
              window.confirmationResult = confirmationResult;
            }).catch(function(error) {
              // Error; SMS not sent
              // [START_EXCLUDE]
              console.error('Error during signInWithPhoneNumber', error);
              window.alert('Error during signInWithPhoneNumber:\n\n'
                  + error.code + '\n\n' + error.message);
              document.getElementById('sign-in-button').disabled = false;
              // [END_EXCLUDE]
            });
        // [END signin]
      } else {
        // [START signout]
        firebase.auth().signOut();
        // [END signout]
      }
    }

    /**
     * Function called when clicking the "Verify Code" button.
     */
    function verifyCode(e) {
      document.getElementById('verify-code-button').disabled = true;<commit_msg>Some fixes and polish for the phone auth sample.<commit_after><!DOCTYPE html>
<!--
Copyright (c) 2016 Google Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html>
<head>
  <meta charset=utf-8 />
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Phone Authentication with Popup</title>

  <!-- Material Design Theming -->
  <link rel="stylesheet" href="https://code.getmdl.io/1.1.3/material.orange-indigo.min.css">
  <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
  <script defer src="https://code.getmdl.io/1.1.3/material.min.js"></script>

  <link rel="stylesheet" href="main.css">

  <!-- Import and configure the Firebase SDK -->
  <!-- These scripts are made available when the app is served or deployed on Firebase Hosting -->
  <!-- If you do not serve/host your project using Firebase Hosting see https://firebase.google.com/docs/web/setup -->
  <script src="/__/firebase/4.0.0/firebase-app.js"></script>
  <script src="/__/firebase/4.0.0/firebase-auth.js"></script>
  <script src="/__/firebase/init.js"></script>

  <script type="text/javascript">

    /**
     * Function called when clicking the Login/Logout button.
     */
    function toggleSignIn(e) {
      e.preventDefault();
      document.getElementById('sign-in-button').disabled = true;
      if (!firebase.auth().currentUser) {
        // [START signin]
        var phoneNumber = getPhoneNumberFromUserInput();
        var appVerifier = window.recaptchaVerifier;
        firebase.auth().signInWithPhoneNumber(phoneNumber, appVerifier)
            .then(function(confirmationResult) {
              // SMS sent. Prompt user to type the code from the message, then sign the
              // user in with confirmationResult.confirm(code).
              window.confirmationResult = confirmationResult;
              showVerificationCodeForm();
            }).catch(function(error) {
              // Error; SMS not sent
              // [START_EXCLUDE]
              console.error('Error during signInWithPhoneNumber', error);
              window.alert('Error during signInWithPhoneNumber:\n\n'
                  + error.code + '\n\n' + error.message);
              document.getElementById('sign-in-button').disabled = false;
              // [END_EXCLUDE]
            });
        // [END signin]
      } else {
        // [START signout]
        firebase.auth().signOut();
        // [END signout]
      }
    }

    /**
     * Displays the Verification Code input form.
     */
    function showVerificationCodeForm() {
      document.getElementById('verification-code-form').style.display = 'block';
      document.getElementById('verify-code-button').disabled = false;
    }

    /**
     * Function called when clicking the "Verify Code" button.
     */
    function verifyCode(e) {
      document.getElementById('verify-code-button').disabled = true;
{'fraction_non_alphanumeric': 0.12978000885870367, 'fraction_numerical': 0.007234608002362321, 'mean_word_length': 2.771714922048998, 'pattern_counts': {'":': 0, '<': 54, '<?xml version=': 0, '>': 54, 'https://': 9, 'lorem ipsum': 0, 'www.': 3, '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': '713375', 'n_tokens_mistral': 1919, 'n_tokens_neox': 1859, 'n_words': 506}