Skip to content
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

Verify email #47

Merged
merged 5 commits into from
Feb 5, 2017
Merged

Verify email #47

merged 5 commits into from
Feb 5, 2017

Conversation

pradel
Copy link
Member

@pradel pradel commented Feb 1, 2017

No description provided.

@@ -12,6 +12,7 @@ export interface DBInterface {
findUserByEmail(email: string) : Promise<?UserObjectType>,
findUserByUsername(username: string) : Promise<?UserObjectType>,
findUserById(userId: string) : Promise<?UserObjectType>,
findUserByEmailVerificationToken(token: string) : Promise<?UserObjectType>,
Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure about the name of the function

@@ -1,5 +1,8 @@
// @flow
import jwt from 'jsonwebtoken';
import crypto from 'crypto';

export const generateToken = (length: Int = 43) => crypto.randomBytes(length).toString('hex');
Copy link
Member Author

Choose a reason for hiding this comment

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

Is it a good place for this function?

Copy link
Member

Choose a reason for hiding this comment

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

Good place. I'd call it generateEmailToken.

message: 'Verify email link expired',
});
}
const tokenRecord = find(user.services.email.verificationTokens,
Copy link
Member Author

Choose a reason for hiding this comment

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

@TimMikeladze will all dbInterfaces return the user object formatted in the same way ?

Copy link
Member

Choose a reason for hiding this comment

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

Yes they should.

message: 'Verify email link expired',
});
}
const tokenRecord = find(user.services.email.verificationTokens,
Copy link
Member

Choose a reason for hiding this comment

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

Need to add services to the UserObjectType

message: 'Verify email link expired',
});
}
const emailRecord = find(user.emails, (e: Object) => e.address === tokenRecord.address);
Copy link
Member

Choose a reason for hiding this comment

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

Need to make another modification to the UserObjecType and the places it is returned at, since it has a string email key. Perhaps this could be an explicit call to a this.findEmailByToken function?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it will be the only place we will need this function, I don't think it's necessary to make a special function.

message: 'Verify email link expired',
});
}
const tokenRecord = find(user.services.email.verificationTokens,
Copy link
Member

Choose a reason for hiding this comment

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

Yes they should.

@@ -1,5 +1,8 @@
// @flow
import jwt from 'jsonwebtoken';
import crypto from 'crypto';

export const generateToken = (length: Int = 43) => crypto.randomBytes(length).toString('hex');
Copy link
Member

Choose a reason for hiding this comment

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

Good place. I'd call it generateEmailToken.

@pradel pradel changed the title [WIP] verify email Verify email Feb 4, 2017
@pradel pradel merged commit 6390441 into master Feb 5, 2017
@pradel pradel deleted the email-reset branch February 5, 2017 11:58
Aetherall pushed a commit that referenced this pull request Mar 11, 2018
Aetherall pushed a commit that referenced this pull request Mar 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants