Преглед изворни кода

Merge pull request #223 from weseek/master

release v2.3.1
Yuki Takei пре 8 година
родитељ
комит
8c58ec88b6
5 измењених фајлова са 22 додато и 3 уклоњено
  1. 6 0
      CHANGES.md
  2. 11 1
      lib/models/user.js
  3. 3 1
      lib/routes/login-passport.js
  4. 1 0
      lib/util/xss.js
  5. 1 1
      package.json

+ 6 - 0
CHANGES.md

@@ -1,6 +1,12 @@
 CHANGES
 ========
 
+## 2.3.1
+
+* Fix: Blockquote doesn't work
+    * Degraded by 2.3.0
+* Fix: Couldn't create user with first LDAP logging in
+
 ## 2.3.0
 
 * Feature: LDAP Authentication

+ 11 - 1
lib/models/user.js

@@ -33,6 +33,11 @@ module.exports = function(crowi) {
     name: { type: String },
     username: { type: String, required: true, unique: true },
     email: { type: String, unique: true, sparse: true },
+    //// The official settings
+    // username: { type: String, index: true },
+    // email: { type: String, required: true, index: true },
+    //// crowi-plus (>= 2.1.0, <2.3.0) settings
+    // email: { type: String, required: true, unique: true },
     introduction: { type: String },
     password: String,
     apiToken: String,
@@ -71,6 +76,11 @@ module.exports = function(crowi) {
     }
   }
 
+  function generateRandomEmail() {
+    const randomstr = generateRandomTempPassword();
+    return `change-it-${randomstr}@example.com`
+  }
+
   function generateRandomTempPassword () {
     var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!=-_';
     var password = '';
@@ -672,7 +682,7 @@ module.exports = function(crowi) {
 
     newUser.name = name;
     newUser.username = username;
-    newUser.email = email;
+    newUser.email = email || generateRandomEmail();   // don't set undefined for backward compatibility -- 2017.12.27 Yuki Takei
     if (password != null) {
       newUser.setPassword(password);
     }

+ 3 - 1
lib/routes/login-passport.js

@@ -105,11 +105,13 @@ module.exports = function(crowi, app) {
           });
         })
         .catch((err) => {
-          debug('findOrRegister error: ', err);
           if (err.name != null && err.name === 'DuplicatedUsernameException') {
             req.flash('isDuplicatedUsernameExceptionOccured', true);
             return next();
           }
+          else {
+            return next(err);
+          }
         });
 
     })(req, res, next);

+ 1 - 0
lib/util/xss.js

@@ -7,6 +7,7 @@ class Xss {
     let option = {
       stripIgnoreTag: true,
       css: false,
+      escapeHtml: (html) => html,
     };
     if (isAllowAllAttrs) {
       // allow all attributes

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "crowi-plus",
-  "version": "2.3.0-RC",
+  "version": "2.3.1-RC",
   "description": "Enhanced Crowi",
   "tags": [
     "wiki",