src/ApplicationBundle/Modules/HoneybeeWeb/Resources/views/pages/find_account.html.twig line 1

Open in your IDE?
  1. {% include '@Application/inc/central_header.html.twig' %}
  2. <section class="create-account-page section">
  3.     <div class="container">
  4.         <div class="row">
  5.             <div class="col-md-12 d-flex justify-content-center align-items-center">
  6.                 <div class="section-head-area">
  7.                     <h1 class="section-title">Find Your Account</h1>
  8.                 </div>
  9.             </div>
  10.         </div>
  11.         <div class="row">
  12.             <div class="signup-form-wrapper">
  13.                 <form class="signup-form" name="signup_form" id="relevantForm" method="post">
  14.                     <div class="email warning-">
  15.                         <label for="email" >Please Provide Your Email Address</label>
  16.                         <input type="email"  class=" exist-error email checkIfExists {{ errorField=='email'?'error_class':'' }}" id="email" name="email" data-field-type="email" required>
  17.                         <p class="small_error_text email"></p>
  18.                     </div>
  19.                     <button type="submit" class="submit-button rel_form_submit" style='background-color: #2673B8' id="" >Confirm</button>
  20.                     <p class="login-link"> <a href="{{ url('user_login') }}">Back to Login</a></p>
  21.                 </form>
  22.             </div>
  23.         </div>
  24.     </div>
  25. </section>
  26. {% include '@HoneybeeWeb/footer/central_footer.html.twig' %}
  27. <script>
  28.     var fbt='';
  29.     function validatePassword(txt) {
  30.         var p = txt,
  31.             errors = [];
  32.         if (p.length < 8) {
  33.             errors.push("Your password must be at least 8 characters");
  34.         }
  35.         if (p.search(/[a-z]/i) < 0) {
  36.             errors.push("Your password must contain at least one letter.");
  37.         }
  38.         if (p.search(/[0-9]/) < 0) {
  39.             errors.push("Your password must contain at least one digit.");
  40.         }
  41.         if (errors.length > 0) {
  42.             return errors.join(" and ");
  43.         }
  44.         return '';
  45.     }
  46.     $(document).ready(function(){
  47.         $.ajaxSetup({ cache: true });
  48.         $.getScript('https://connect.facebook.net/en_US/sdk.js', function(){
  49.             FB.init({
  50.                 appId: '1116951735682132',
  51.                 version: 'v2.7' // or v2.1, v2.2, v2.3, ...
  52.             });
  53.             $('#loginbutton,#feedbutton').removeAttr('disabled');
  54.             FB.getLoginStatus(function(response) {
  55.                 //    console.log(response);
  56. //                statusChangeCallback(response);
  57.             });
  58.             $('#fb_login').click(function(e){
  59.                 e.preventDefault();
  60.                 FB.login(function(response) {
  61.                         //    console.log(response)
  62.                         //    console.log(response.authResponse)
  63.                         if (response.authResponse) {
  64.                             fbt=response.authResponse.accessToken;
  65.                             //    console.log('Welcome!  Fetching your information.... ');
  66. //                        alert('This feature will be available on 12 Dec, please use other login method for now.')
  67.                             FB.api('/me?fields=id,name,email,picture', function(response) {
  68. //                            $('#fb_login_form').clear();
  69.                                 var split_name=response.name.split(' ');
  70.                                 var f_name=split_name[0];
  71.                                 var l_name=(typeof split_name[1] !== 'undefined')? split_name[1]:'';
  72.                                 if(typeof response.email !== 'undefined') {
  73.                                     $('#fb_login_form').html(
  74.                                         '<input type="hidden" id="email_for_fb_login" name="email" value="' + response.email + '">' +
  75.                                         '<input type="hidden" name="oAuthHash" value="_NONE_">' +
  76.                                         '<input type="hidden" name="image" value="' + response.picture.data.url + '">' +
  77.                                         '<input type="hidden" name="uniqueId" value="' + response.id + '">' +
  78.                                         '<input type="hidden" name="emailVerified" value="' + response.email + '">' +
  79.                                         '<input type="hidden" name="firstName" value="' + f_name + '">' +
  80.                                         '<input type="hidden" name="lastName" value="' + l_name + '">' +
  81.                                         '<input type="hidden" name="type" value="1">' +
  82.                                         '<input type="hidden" name="oAuthtoken" value="' + fbt + '">'
  83.                                     );
  84.                                     $('#fb_login_form').submit();
  85.                                 }
  86.                                 else
  87.                                 {
  88.                                     $('#fb_login_form').html(
  89.                                         '<input type="hidden" id="email_for_fb_login" name="email" value="">' +
  90.                                         '<input type="hidden" name="oAuthHash" value="_NONE_">' +
  91.                                         '<input type="hidden" name="image" value="' + response.picture.data.url + '">' +
  92.                                         '<input type="hidden" name="uniqueId" value="' + response.id + '">' +
  93.                                         '<input type="hidden" name="emailVerified" value="' + response.email + '">' +
  94.                                         '<input type="hidden" name="firstName" value="' + f_name + '">' +
  95.                                         '<input type="hidden" name="lastName" value="' + l_name + '">' +
  96.                                         '<input type="hidden" name="type" value="1">' +
  97.                                         '<input type="hidden" name="oAuthtoken" value="' + fbt + '">'
  98.                                     );
  99. //                                alert('you need to provide your email address access on facebook.')
  100.                                     swal({
  101.                                             title: "Validate Action!",
  102.                                             text: "Please Provide Your Approval Hash:",
  103.                                             type: "input",
  104.                                             inputType: "password",
  105.                                             showCancelButton: true,
  106.                                             closeOnConfirm: true,
  107.                                             animation: "slide-from-top",
  108.                                             inputPlaceholder: "Approval Hash"
  109.                                         },
  110.                                         function (inputValue) {
  111.                                             if (inputValue === false) return false;
  112.                                             else if (inputValue === "") {
  113.                                                 swal.showInputError("Email Needed!");
  114.                                                 return false
  115.                                             }
  116.                                             else if (inputValue != '') {
  117.                                                 $('#email_for_fb_login').val(inputValue)
  118.                                                 $('#fb_login_form').submit();
  119.                                                 //$(form_object).submit();
  120.                                             }
  121.                                             //swal("Nice!", "You wrote: " + inputValue, "success");
  122.                                         });
  123.                                 }
  124.                                 //    console.log('Good to see you, ' + response.name + '.');
  125.                                 //    console.log(response)
  126.                             });
  127.                         } else {
  128.                             //    console.log('User cancelled login or did not fully authorize.');
  129.                         }
  130.                     }
  131.                     , {scope: 'public_profile,email'}
  132.                 );
  133.             })
  134.         });
  135.         $('.signup-form input').focus(function () {
  136. //            if()
  137. //            $('.login-inputs input').removeClass('error_class');
  138.             $(this).removeClass('error_class');
  139.         })
  140.         $('.signup-form input').change(function () {
  141. //            if()
  142. //            $('.login-inputs input').removeClass('error_class');
  143.             if($(this).hasClass('checkIfExists'))
  144.             {
  145.                 check_field_validity($(this).attr('data-field-type'))
  146.             }
  147.             check_doc_and_submit(0); //check only not submit
  148.         })
  149.         function  check_field_validity(fieldType)
  150.         {
  151.             fieldType = fieldType || 'email';
  152.             // alert(fieldType)
  153.             $('.small_error_text.' + fieldType).text('')
  154.             $('.small_error_text.' + fieldType).hide()
  155.             $('.small_error_icon.' + fieldType).removeClass('success').removeClass('error');
  156.             $('.small_error_icon.' + fieldType).removeClass('fa-check').removeClass('fa-times');
  157.             $('.small_error_icon.' + fieldType).addClass('fa-spinner');
  158.             $('.small_error_icon.' + fieldType).show()
  159.             $.post('{{ url('check_if_email_exists_already') }}', {
  160.                 fieldType: fieldType,
  161.                 fieldValue: $('.signup-form input.' + fieldType).val(),
  162.                 signUpUserType: {{ userType }},
  163.             })
  164.                 .done(function (data) {
  165.                         //sales.clearItemTable()
  166.                         fieldType = data.fieldType;
  167.                         if (data.alreadyExists != true) {
  168.                             $('.small_error_text.' + fieldType).text('Could not find your email')
  169.                             $('.small_error_text.' + fieldType).show()
  170.                             $('.small_error_icon.' + fieldType).removeClass('fa-spinner').removeClass('success');
  171.                             $('.small_error_icon.' + fieldType).addClass('fa-times').addClass('error');
  172.                             $('.small_error_icon.' + fieldType).show()
  173.                         }
  174.                         else {
  175.                             $('.small_error_text.' + fieldType).text('')
  176.                             $('.small_error_text.' + fieldType).hide()
  177.                             $('.small_error_icon.' + fieldType).removeClass('fa-spinner').removeClass('error');
  178.                             $('.small_error_icon.' + fieldType).addClass('fa-check').addClass('success');
  179.                             $('.small_error_icon.' + fieldType).show()
  180.                         }
  181.                     }
  182.                 );
  183.         }
  184.         function check_doc_and_submit(submitFlag) {
  185.             var checkFailed = 0;
  186.             submitFlag=submitFlag||0
  187.             /////check if any checking needed here
  188.             $('.signup-form input').each(function(ind,elem){
  189.                 if($(this).prop('required')){
  190.                     if ($(this).attr('type') == 'checkbox' && $(this).prop('checked') == false)
  191.                         checkFailed=1
  192.                     else if($(this).val()=='' || $(this).val()==0)
  193.                         checkFailed=1;
  194. //                    //    console.log("REQ");
  195.                 } else {
  196. //                    //    console.log("NREQ");
  197.                 }
  198.             });
  199.             $('.small_error_text').each(function(ind,elem)
  200.             {
  201.                 if($(elem).text()!='')
  202.                     checkFailed=1;
  203.             })
  204.             $('.small_error_text').each(function(ind,elem)
  205.             {
  206.                 if($(elem).text()!='')
  207.                     checkFailed=1;
  208.             })
  209.             if(checkFailed==0)
  210.                 $('.rel_form_submit').addClass('ready');
  211.             else
  212.             {
  213.                 $('.rel_form_submit').removeClass('ready');
  214.             }
  215.             if (checkFailed == 0 && submitFlag==1) {
  216.                 $('.rel_form_submit').removeClass('ready');
  217.                 $('.rel_form_submit').hide();
  218.                 $('#relevantForm').submit();
  219.             }
  220.         }
  221.         //For save action
  222.         $('input[type="submit"], button[type="submit"], .rel_form_submit').click(function (event) {
  223.             event.preventDefault();
  224.             // alert('HI')
  225.             check_doc_and_submit(1);
  226.         })
  227.         check_doc_and_submit(0)
  228.     })
  229. </script>