Skip to content

Commit 5f8805d

Browse files
author
thegitfather
committed
fix(server:oauth): fix mongoose validation when re-login using twitter oauth
Problem occurs after second login attempt using passport-twitter. Error message: "ValidationError: The specified email address is already in use."
1 parent ecea989 commit 5f8805d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Diff for: app/templates/server/api/user(auth)/user.model(mongooseModels).js

+3
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ UserSchema
9595
.path('email')
9696
.validate(function(value, respond) {
9797
var self = this;
98+
if (authTypes.indexOf(this.provider) !== -1) {
99+
return respond(true);
100+
}
98101
return this.constructor.findOne({ email: value }).exec()
99102
.then(function(user) {
100103
if (user) {

0 commit comments

Comments
 (0)