瀏覽代碼

fix: check for email array during processProfile (#2515)

In our setup (based on yunohost) the profile.email field could be either a string (and that was properly handled) or an array.
This code adds support for the case where it is an array.
Mirko Iannella 4 年之前
父節點
當前提交
31a18c8a67
共有 1 個文件被更改,包括 2 次插入0 次删除
  1. 2 0
      server/models/users.js

+ 2 - 0
server/models/users.js

@@ -177,6 +177,8 @@ module.exports = class User extends Model {
     if (_.isArray(profile.emails)) {
       const e = _.find(profile.emails, ['primary', true])
       primaryEmail = (e) ? e.value : _.first(profile.emails).value
+    } else if (_.isArray(profile.email)) {
+      primaryEmail = _.first(_.flattenDeep([profile.email]));
     } else if (_.isString(profile.email) && profile.email.length > 5) {
       primaryEmail = profile.email
     } else if (_.isString(profile.mail) && profile.mail.length > 5) {