Skip to content

Commit 297aa25

Browse files
authored
Release3.5.2 (#544)
- Improved the error message when outdated email link is used for email link sign in and forceSameDevice is enabled. - Fixed the issue that wrong language code is used for Portuguese (Brazilian).
1 parent 3cb03f1 commit 297aa25

File tree

9 files changed

+549
-19
lines changed

9 files changed

+549
-19
lines changed

LANGUAGES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
| lt | Lithuanian |
3131
| no | Norwegian (Bokmal) |
3232
| pl | Polish |
33-
| pt | Portuguese |
33+
| pt_br | Portuguese (Brazil) |
3434
| pt_pt | Portuguese (Portugal) |
3535
| ro | Romanian |
3636
| ru | Russian |

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,17 @@ Localized versions of the widget are available through the CDN. To use a localiz
6868
localized JS library instead of the default library:
6969

7070
```html
71-
<script src="https://www.gstatic.com/firebasejs/ui/3.5.1/firebase-ui-auth__{LANGUAGE_CODE}.js"></script>
72-
<link type="text/css" rel="stylesheet" href="https://www.gstatic.com/firebasejs/ui/3.5.1/firebase-ui-auth.css" />
71+
<script src="https://www.gstatic.com/firebasejs/ui/3.5.2/firebase-ui-auth__{LANGUAGE_CODE}.js"></script>
72+
<link type="text/css" rel="stylesheet" href="https://www.gstatic.com/firebasejs/ui/3.5.2/firebase-ui-auth.css" />
7373
```
7474

7575
where `{LANGUAGE_CODE}` is replaced by the code of the language you want. For example, the French
7676
version of the library is available at
77-
`https://www.gstatic.com/firebasejs/ui/3.5.1/firebase-ui-auth__fr.js`. The list of available
77+
`https://www.gstatic.com/firebasejs/ui/3.5.2/firebase-ui-auth__fr.js`. The list of available
7878
languages and their respective language codes can be found at [LANGUAGES.md](LANGUAGES.md).
7979

8080
Right-to-left languages also require the right-to-left version of the stylesheet, available at
81-
`https://www.gstatic.com/firebasejs/ui/3.5.1/firebase-ui-auth-rtl.css`, instead of the default
81+
`https://www.gstatic.com/firebasejs/ui/3.5.2/firebase-ui-auth-rtl.css`, instead of the default
8282
stylesheet. The supported right-to-left languages are Arabic (ar), Farsi (fa), and Hebrew (iw).
8383

8484
### Option 2: npm Module

changelog.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
fixed - Improves the error message when outdated email link is used for email link sign in and `forceSameDevice` is enabled.
2+
fixed - Fixes the wrong language code for Portuguese (Brazilian).

gulpfile.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ const DEFAULT_LOCALE = 'en';
7171
// The list of all locales that are supported.
7272
const ALL_LOCALES = ['ar-XB', 'ar', 'bg', 'ca', 'cs', 'da', 'de', 'el', 'en',
7373
'en-GB', 'en-XA', 'es-419', 'es', 'fa', 'fi', 'fil', 'fr', 'hi', 'hr', 'hu',
74-
'id', 'it', 'iw', 'ja', 'ko', 'lt', 'lv', 'nl', 'no', 'pl', 'pt-PT', 'pt',
75-
'ro', 'ru', 'sk', 'sl', 'sr', 'sv', 'th', 'tr', 'uk', 'vi', 'zh-CN',
76-
'zh-TW'];
74+
'id', 'it', 'iw', 'ja', 'ko', 'lt', 'lv', 'nl', 'no', 'pl', 'pt-PT',
75+
'pt-BR', 'ro', 'ru', 'sk', 'sl', 'sr', 'sv', 'th', 'tr', 'uk', 'vi',
76+
'zh-CN', 'zh-TW'];
7777

7878
// Default arguments to pass into Closure Compiler.
7979
const COMPILER_DEFAULT_ARGS = {

javascript/widgets/handler/emaillinksignincallback.js

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ firebaseui.auth.widget.handler.handleEmailLinkSignInCallback = function(
7575
var forceSameDevice = urlBuilder.getForceSameDevice();
7676
var anonymousUid = urlBuilder.getAnonymousUid();
7777
var providerId = urlBuilder.getProviderId();
78+
var isNewDevice = !firebaseui.auth.storage.hasEmailForSignIn(app.getAppId());
7879
var email = opt_email || firebaseui.auth.storage.getEmailForSignIn(
7980
sessionId, app.getAppId());
8081
var pendingCredential = firebaseui.auth.storage.getEncryptedPendingCredential(
@@ -133,7 +134,7 @@ firebaseui.auth.widget.handler.handleEmailLinkSignInCallback = function(
133134

134135
var checkActionCodeAndGetUser = function() {
135136
var anonymousUserPromise = goog.Promise.resolve(null);
136-
if ((anonymousUid && !email) || (!email && forceSameDevice)) {
137+
if ((anonymousUid && isNewDevice) || (isNewDevice && forceSameDevice)) {
137138
// Anonymous user with different device flow or regular sign in flow with
138139
// same device requirement on different device.
139140
anonymousUserPromise = goog.Promise.reject(
@@ -169,15 +170,23 @@ firebaseui.auth.widget.handler.handleEmailLinkSignInCallback = function(
169170
app, component, email, link, credential,
170171
/** @type {?firebase.User} */ (user));
171172
} else {
172-
component.dispose();
173-
// On email confirmation, call this handler again with
174-
// skipCodeCheck set to true.
175-
firebaseui.auth.widget.handler.handle(
176-
firebaseui.auth.widget.HandlerName.EMAIL_LINK_CONFIRMATION,
173+
if (forceSameDevice) {
174+
component.dispose();
175+
firebaseui.auth.widget.handler.handle(
176+
firebaseui.auth.widget.HandlerName.DIFFERENT_DEVICE_ERROR,
177177
app,
178-
container,
179-
link,
180-
firebaseui.auth.widget.handler.completeEmailConfirmation_);
178+
container);
179+
} else {
180+
component.dispose();
181+
// On email confirmation, call this handler again with
182+
// skipCodeCheck set to true.
183+
firebaseui.auth.widget.handler.handle(
184+
firebaseui.auth.widget.HandlerName.EMAIL_LINK_CONFIRMATION,
185+
app,
186+
container,
187+
link,
188+
firebaseui.auth.widget.handler.completeEmailConfirmation_);
189+
}
181190
}
182191
},
183192
onError));

javascript/widgets/handler/emaillinksignincallback_test.js

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,66 @@ function testHandleEmailLinkSignInCallback_expiredActionCodeError() {
959959
}
960960

961961

962+
function testHandleEmailLinkSignInCallback_oldLinkClicked() {
963+
// Test when old email link is clicked, code expired error should be
964+
// displayed. In this case, the email is stored with new session ID which is
965+
// different from the session ID in the old link.
966+
var expectedError = {'code': 'auth/expired-action-code'};
967+
var email = passwordAccount.getEmail();
968+
var link = generateSignInLink('OLD_SESSIONID', null, null, true);
969+
setupEmailLinkSignIn('NEW_SESSIONID', email);
970+
971+
firebaseui.auth.widget.handler.handleEmailLinkSignInCallback(
972+
app, container, link);
973+
assertBlankPage();
974+
975+
// Simulate expired error code.
976+
var waitForCheckActionCode = testAuth.assertCheckActionCode(
977+
['ACTION_CODE'],
978+
null,
979+
expectedError);
980+
return waitForCheckActionCode.then(function() {
981+
delayForBusyIndicatorAndAssertIndicatorShown();
982+
return testAuth.process();
983+
}).then(function() {
984+
assertBusyIndicatorHidden();
985+
// Provider sign-in page should be rendered with error in info bar.
986+
assertProviderSignInPage();
987+
assertInfoBarMessage(
988+
firebaseui.auth.widget.handler.common.getErrorMessage(expectedError));
989+
});
990+
}
991+
992+
993+
function testHandleEmailLinkSignInCallback_sessionMismatch() {
994+
var email = passwordAccount.getEmail();
995+
var link = generateSignInLink('NEW_SESSIONID', null, null, true);
996+
setupEmailLinkSignIn('OLD_SESSIONID', email);
997+
998+
firebaseui.auth.widget.handler.handleEmailLinkSignInCallback(
999+
app, container, link);
1000+
assertBlankPage();
1001+
1002+
var waitForCheckActionCode = testAuth.assertCheckActionCode(
1003+
['ACTION_CODE'],
1004+
function() {
1005+
return {
1006+
'operation': 'EMAIL_SIGNIN'
1007+
};
1008+
});
1009+
return waitForCheckActionCode.then(function() {
1010+
delayForBusyIndicatorAndAssertIndicatorShown();
1011+
return testAuth.process();
1012+
}).then(function() {
1013+
assertBusyIndicatorHidden();
1014+
assertDifferentDeviceErrorPage();
1015+
// Clicking dismiss button should redirect to the first page.
1016+
clickSecondaryLink();
1017+
assertProviderSignInPage();
1018+
});
1019+
}
1020+
1021+
9621022
function testHandleEmailLinkSignInCallback_signInError() {
9631023
var email = passwordAccount.getEmail();
9641024
var link = generateSignInLink('SESSIONID');

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

translations/iw.xtb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@
145145
<translation id="3561568594856945084">מאיוט</translation>
146146
<translation id="3591063723610544836">כניסה</translation>
147147
<translation id="3593480381831738519">איפוס הסיסמה</translation>
148-
<translation id="3597673897213051724">שלח</translation>
148+
<translation id="3597673897213051724">שליחה</translation>
149149
<translation id="3605933028246642593">נפאל</translation>
150150
<translation id="3608140835232496799">טוקלאו</translation>
151151
<translation id="3620185428620643248">פרטי הכניסה שנבחרו לספק האימות אינם נתמכים.</translation>

0 commit comments

Comments
 (0)