OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 cr.define('options', function() { | 5 cr.define('options', function() { |
6 const OptionsPage = options.OptionsPage; | 6 const OptionsPage = options.OptionsPage; |
7 | 7 |
8 // Variable to track if a captcha challenge was issued. If this gets set to | 8 // Variable to track if a captcha challenge was issued. If this gets set to |
9 // true, it stays that way until we are told about successful login from | 9 // true, it stays that way until we are told about successful login from |
10 // the browser. This means subsequent errors (like invalid password) are | 10 // the browser. This means subsequent errors (like invalid password) are |
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 }, | 725 }, |
726 | 726 |
727 matchesASPRegex_: function(toMatch) { | 727 matchesASPRegex_: function(toMatch) { |
728 var noSpaces = /[a-z]{16}/; | 728 var noSpaces = /[a-z]{16}/; |
729 var withSpaces = /([a-z]{4}\s){3}[a-z]{4}/; | 729 var withSpaces = /([a-z]{4}\s){3}[a-z]{4}/; |
730 if (toMatch.match(noSpaces) || toMatch.match(withSpaces)) | 730 if (toMatch.match(noSpaces) || toMatch.match(withSpaces)) |
731 return true; | 731 return true; |
732 return false; | 732 return false; |
733 }, | 733 }, |
734 | 734 |
| 735 populatePromoMessage_: function(resName) { |
| 736 // Fetch the strings associated with |resName| and set it if it's not |
| 737 // empty. If it's empty, we'll stick with the default text. |
| 738 var text = localStrings.getString(resName); |
| 739 if (!text || !text.length) { |
| 740 return; |
| 741 } |
| 742 $('sync-setup-login-promo-body').textContent = text; |
| 743 }, |
| 744 |
735 setErrorVisibility_: function() { | 745 setErrorVisibility_: function() { |
736 this.resetErrorVisibility_(); | 746 this.resetErrorVisibility_(); |
737 var f = $('gaia-login-form'); | 747 var f = $('gaia-login-form'); |
738 var email = $('gaia-email'); | 748 var email = $('gaia-email'); |
739 var passwd = $('gaia-passwd'); | 749 var passwd = $('gaia-passwd'); |
740 if (null == email.value || "" == email.value) { | 750 if (null == email.value || "" == email.value) { |
741 $('errormsg-0-email').hidden = false; | 751 $('errormsg-0-email').hidden = false; |
742 this.setBlurbError_(); | 752 this.setBlurbError_(); |
743 return false; | 753 return false; |
744 } | 754 } |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 }; | 885 }; |
876 | 886 |
877 SyncSetupOverlay.showSuccessAndSettingUp = function() { | 887 SyncSetupOverlay.showSuccessAndSettingUp = function() { |
878 SyncSetupOverlay.getInstance().showSuccessAndSettingUp_(); | 888 SyncSetupOverlay.getInstance().showSuccessAndSettingUp_(); |
879 }; | 889 }; |
880 | 890 |
881 SyncSetupOverlay.showStopSyncingUI = function() { | 891 SyncSetupOverlay.showStopSyncingUI = function() { |
882 SyncSetupOverlay.getInstance().showStopSyncingUI_(); | 892 SyncSetupOverlay.getInstance().showStopSyncingUI_(); |
883 }; | 893 }; |
884 | 894 |
| 895 SyncSetupOverlay.populatePromoMessage = function(resName) { |
| 896 SyncSetupOverlay.getInstance().populatePromoMessage_(resName); |
| 897 }; |
| 898 |
885 // Export | 899 // Export |
886 return { | 900 return { |
887 SyncSetupOverlay: SyncSetupOverlay | 901 SyncSetupOverlay: SyncSetupOverlay |
888 }; | 902 }; |
889 }); | 903 }); |
OLD | NEW |