File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
packages/fxa-settings/src/pages/Signin Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -91,7 +91,23 @@ import OAuthDataError from '../../components/OAuthDataError';
91
91
*/
92
92
93
93
function getAccountInfo ( email ?: string ) {
94
- const storedLocalAccount = currentAccount ( ) || lastStoredAccount ( ) ;
94
+
95
+ const storedLocalAccount = ( ( ) => {
96
+ let account = currentAccount ( ) ;
97
+ if ( account ) {
98
+ return account ;
99
+ }
100
+
101
+ // Important, a lot of the code following this assumes that if a session
102
+ // token is provided, it belongs to the current account. If this assumption
103
+ // is violated, weird things happen! Maybe this is the 'fix'?
104
+ account = lastStoredAccount ( ) ;
105
+ if ( account ) {
106
+ setCurrentAccount ( account . uid ) ;
107
+ }
108
+
109
+ return account ;
110
+ } ) ( ) ;
95
111
96
112
if ( email ) {
97
113
// Try to use local storage values if email matches the email in local storage
@@ -107,7 +123,6 @@ function getAccountInfo(email?: string) {
107
123
}
108
124
109
125
if ( storedLocalAccount ) {
110
- setCurrentAccount ( storedLocalAccount . uid ) ;
111
126
return {
112
127
email : storedLocalAccount . email ,
113
128
sessionToken : storedLocalAccount . sessionToken ,
You can’t perform that action at this time.
0 commit comments