← All changes
|
includes/features/Protected_Content/password-form.js
+11
-3
51.1.44
→
51.1.86
View file →
| @@ -27,10 +27,18 @@ | ||
| 27 | 27 | const scope = $form.data('scope'); |
| 28 | 28 | const globalKey = $form.data('global-key'); |
| 29 | 29 | const days = $form.data('days') || 7; |
| 30 | 30 | |
| 31 | + const strings = (window.kingAddonsProtectedContent && window.kingAddonsProtectedContent.strings) | |
| 32 | + ? window.kingAddonsProtectedContent.strings | |
| 33 | + : {}; | |
| 34 | + | |
| 35 | + const enterPasswordText = strings.enterPassword || 'Please enter a password'; | |
| 36 | + const incorrectPasswordText = strings.incorrectPassword || 'Incorrect password'; | |
| 37 | + const errorOccurredText = strings.errorOccurred || 'An error occurred. Please try again.'; | |
| 38 | + | |
| 31 | 39 | if (!password) { |
| 32 | - $error.text('Please enter a password').show(); | |
| 40 | + $error.text(enterPasswordText).show(); | |
| 33 | 41 | return; |
| 34 | 42 | } |
| 35 | 43 | |
| 36 | 44 | // Show loading state. |
| @@ -56,9 +64,9 @@ | ||
| 56 | 64 | if (response.success) { |
| 57 | 65 | // Reload page to show unlocked content. |
| 58 | 66 | window.location.reload(); |
| 59 | 67 | } else { |
| 60 | - $error.text(response.data.message || 'Incorrect password').show(); | |
| 68 | + $error.text(response.data.message || incorrectPasswordText).show(); | |
| 61 | 69 | $input.prop('disabled', false).val('').focus(); |
| 62 | 70 | $submitText.show(); |
| 63 | 71 | $submitLoading.hide(); |
| 64 | 72 | } |
| @@ -63,9 +71,9 @@ | ||
| 63 | 71 | $submitLoading.hide(); |
| 64 | 72 | } |
| 65 | 73 | }, |
| 66 | 74 | error: function () { |
| 67 | - $error.text('An error occurred. Please try again.').show(); | |
| 75 | + $error.text(errorOccurredText).show(); | |
| 68 | 76 | $input.prop('disabled', false); |
| 69 | 77 | $submitText.show(); |
| 70 | 78 | $submitLoading.hide(); |
| 71 | 79 | } |