-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RCORE-2200: Fix switch_user and get_profile during log_in_with_credentials #7894
Changes from 9 commits
2c9fb5d
d9bafee
aa4ed42
9f24ee0
00c6d84
fcf42a0
f30b5a1
6dec175
c115487
0ef30cb
14afead
65cc0a6
98fa7c4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -835,8 +835,12 @@ void App::log_in_with_credentials(const AppCredentials& credentials, const std:: | |
return completion(nullptr, | ||
AppError(ErrorCodes::BadToken, "Could not log in user: received malformed JWT")); | ||
} | ||
switch_user(user); | ||
get_profile(user, std::move(completion)); | ||
|
||
get_profile(user, [this, completion = std::move(completion)](const std::shared_ptr<User>& user, | ||
Optional<AppError> error) { | ||
switch_user(user); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We probably only want to switch users if the profile fetch succeeded? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would that be a better experience? We'd potentially be breaking more functionality which isn't necessarily dependent on the user's profile itself (i.e. giving the client the new user on completition callback but it having no profile and an error to handle seems nicer than not giving the client the new user at all or giving it on the completition callback with the error but not actually switching the user) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the initial profile fetch fails then the user effectively isn't logged in yet and isn't really in a usable state. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tgoyne made the change, let me know if more is needed |
||
completion(user, error); | ||
}); | ||
}, | ||
false); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't worked with C++ in a little while, tried to get it to be equivalent but let me know if this move, etc. doesn't make sense