浏览代码

feat: password use MD5 + salt

Casper Dai 3 年之前
父节点
当前提交
2e1f27847c

+ 2 - 2
.env

@@ -41,8 +41,8 @@ VUE_APP_MQTT_PASSWORD = 'inspur-frontend'
 VUE_APP_CAMERA_PROXY = '/prod-api/websocket'
 
 # user default password
-# VUE_APP_USER_PASSWORD = '111111'
-VUE_APP_USER_PASSWORD = '96e79218965eb72c92a549dd5a330112'
+# MD5('111111' + MD5('123456a?'))
+VUE_APP_USER_PASSWORD = '6bb301858f5df774b0154dd56f85bc84'
 
 # gaode
 VUE_APP_GAODE_MAP_KEY = '9c499e7000d066c05de9af8556a890f7'

二进制
keycloak-theme/login.zip


+ 3 - 3
keycloak-theme/login/login-update-password.ftl

@@ -80,12 +80,12 @@
       </button>
     </form>
   </div>
-  <script src="${url.resourcesPath}/js/md5.min.js"></script>
+  <script src="${url.resourcesPath}/js/md5.js"></script>
   <script>
     function onSubmit () {
       var form = document.getElementById('loginForm')
-      document.getElementById('passwordNew').value = MD5(document.getElementById('passwordNewProxy').value)
-      document.getElementById('passwordConfirm').value = MD5(document.getElementById('passwordConfirmProxy').value)
+      document.getElementById('passwordNew').value = MD5Salt(document.getElementById('passwordNewProxy').value)
+      document.getElementById('passwordConfirm').value = MD5Salt(document.getElementById('passwordConfirmProxy').value)
       form.submit()
     }
   </script>

+ 2 - 2
keycloak-theme/login/login.ftl

@@ -68,12 +68,12 @@
       </button>
     </form>
   </div>
-  <script src="${url.resourcesPath}/js/md5.min.js"></script>
+  <script src="${url.resourcesPath}/js/md5.js"></script>
   <script>
     function onSubmit () {
       var form = document.getElementById('loginForm')
       document.getElementById('username').value = document.getElementById('usernameProxy').value
-      document.getElementById('password').value = MD5(document.getElementById('passwordProxy').value)
+      document.getElementById('password').value = MD5Salt(document.getElementById('passwordProxy').value)
       form.submit()
     }
   </script>

+ 2 - 1
keycloak-theme/login/resources/js/md5.min.js → keycloak-theme/login/resources/js/md5.js

@@ -4,4 +4,5 @@ var MD5=function(r){function n(o){if(t[o])return t[o].exports;var e=t[o]={i:o,l:
  * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
  * @license  MIT
  */
-r.exports=function(r){return null!=r&&(t(r)||o(r)||!!r._isBuffer)}},function(r,n,t){r.exports=t(1)}]);
+r.exports=function(r){return null!=r&&(t(r)||o(r)||!!r._isBuffer)}},function(r,n,t){r.exports=t(1)}]);
+var MD5Salt = function (val) { return MD5(val + '42857cfddb33f3fddb27fff9773683f3'); };