Skip to content

Commit

Permalink
fix(server:oauth): fix mongoose validation when re-login using twitte…
Browse files Browse the repository at this point in the history
…r oauth

Problem occurs after second login attempt using passport-twitter.
Error message: "ValidationError: The specified email address is already in use."
  • Loading branch information
thegitfather committed May 4, 2016
1 parent ecea989 commit 5f8805d
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ UserSchema
.path('email')
.validate(function(value, respond) {
var self = this;
if (authTypes.indexOf(this.provider) !== -1) {
return respond(true);
}
return this.constructor.findOne({ email: value }).exec()
.then(function(user) {
if (user) {
Expand Down

0 comments on commit 5f8805d

Please sign in to comment.