Skip to content

Solution for re-login twitter #1997

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

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ UserSchema
.path('email')
.validate(function(value, respond) {
var self = this;
<%_ if(filters.oauth) { _%>
if (authTypes.indexOf(this.provider) !== -1) {
return respond(true);
}<% } %>
return this.constructor.findOne({ email: value }).exec()
.then(function(user) {
if (user) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ export function setup(User, config) {
callbackURL: config.twitter.callbackURL
},
function(token, tokenSecret, profile, done) {
if(!isNAN(profile._json.id)){
profile._json.id = profile._json.id.toString();
}
Copy link
Member

Choose a reason for hiding this comment

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

I think it would make more sense to do this:

profile._json.id = `${profile._json.id}`;
profile.id = `${profile.id}`;

Copy link
Author

Choose a reason for hiding this comment

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

ok

Copy link
Author

Choose a reason for hiding this comment

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

Yeah that will work.

<% if (filters.mongooseModels) { %>User.findOne({'twitter.id': profile.id}).exec()<% }
if (filters.sequelizeModels) { %>User.find({where:{'twitter.id': profile.id}})<% } %>
.then(user => {
Expand Down