Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Fix registration with email #2967

Merged
merged 3 commits into from
May 14, 2019
Merged

Fix registration with email #2967

merged 3 commits into from
May 14, 2019

Conversation

dbkr
Copy link
Member

@dbkr dbkr commented May 14, 2019

A PR presented in twothree acts.

Act 1, in which we don't set the 'is_registered' flag if we're just restoring an existing account.

Act 2, in which we don't restore guest accounts since we'll usually have one of these when registering.

Act 3, in which Dave has a fight with the linter.

See individual commit messages for more detail.

Regressed in: #2768
Fixes: element-hq/element-web#9581

dbkr added 2 commits May 14, 2019 11:44
We look to see if there's already a user logged in and if there is,
restore that session instead of logging the user in as their new
account. We still set this 'is_registered' flag though, even though
in that case it's not a newly registered account that's being restored,
so don't set in that case.
Regressed in #2768
where we check for an existing stored account first and restore that
instead if it exist, telling the user. We usually make a guest account
when the user first hits the page though, so this just restored this
guest account.

Don't restore the account if it's just a guest account (which, as per
comment, is not perfect, but is definitely better than the current
behaviour).

Fixes element-hq/element-web#9581
@dbkr dbkr requested a review from a team May 14, 2019 11:08
@jryans jryans requested review from jryans and removed request for a team May 14, 2019 12:06
Copy link
Collaborator

@jryans jryans left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this! 😁 It makes sense to me. I hope this will get us back to a better registration flow.

src/Lifecycle.js Outdated
@@ -131,8 +131,8 @@ export function getStoredSessionOwner() {
* for a real user. If there is no stored session, return null.
*/
export function getStoredSessionIsGuest() {
const {hsUrl, isUrl, accessToken, userId, deviceId, isGuest} = _getLocalStorageSessionVars();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I guess you also could have removed the unused ones (deviceId and isUrl) to satisfy the linter...? Anyway, either is fine of course.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, yes - I think I was getting confused between array and object destructuring.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Registration failure
2 participants