system-clients 3.3.3-v3-test1 → 3.3.3-v3-t2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,105 +1,105 @@
1
- {
2
- "name": "system-clients",
3
- "version": "3.3.3-v3-test1",
4
- "description": "系统基础框架",
5
- "main": "src/index.js",
6
- "directories": {
7
- "doc": "doc",
8
- "example": "examples",
9
- "test": "test"
10
- },
11
- "scripts": {
12
- "example": "node build/example-server.js",
13
- "dev": "node build/dev-server.js",
14
- "lint": "eslint src/**.js test/e2e/**.js test/unit/specs/** build/**.js",
15
- "build": "rimraf dist && mkdirp dist && ncp static dist/static && cross-env NODE_ENV=production webpack --progress --hide-modules --config build/webpack.prod.conf.js",
16
- "e2e": "node test/e2e/runner.js",
17
- "unit": "karma start test/unit/karma.conf.js",
18
- "makeall": "rimraf dist && mkdirp dist && ncp static dist/static && cross-env NODE_OPTIONS=--max_old_space_size=4096 NODE_ENV=production webpack --progress --hide-modules --config build/webpack.example.conf.js",
19
- "release": "npm set registry http://registry.npmjs.org && npm publish && npm set registry http://registry.npm.taobao.org"
20
- },
21
- "dependencies": {
22
- "base64-js": "^1.3.0",
23
- "js-base64": "^2.4.9",
24
- "less": "^2.7.1",
25
- "less-loader": "^2.2.3",
26
- "nyc": "^15.1.0",
27
- "src": "^1.1.2",
28
- "vue": "^1.0.17"
29
- },
30
- "devDependencies": {
31
- "babel-core": "^6.0.0",
32
- "babel-loader": "^6.0.0",
33
- "babel-plugin-transform-runtime": "^6.0.0",
34
- "babel-preset-es2015": "^6.0.0",
35
- "babel-preset-stage-2": "^6.0.0",
36
- "chai": "^3.5.0",
37
- "connect-history-api-fallback": "^1.1.0",
38
- "cross-env": "^1.0.7",
39
- "cross-spawn": "^2.1.5",
40
- "css-loader": "^0.23.0",
41
- "eslint": "^2.0.0",
42
- "eslint-config-standard": "^5.1.0",
43
- "eslint-friendly-formatter": "^1.2.2",
44
- "eslint-loader": "^1.3.0",
45
- "eslint-plugin-html": "^1.3.0",
46
- "eslint-plugin-promise": "^1.0.8",
47
- "eslint-plugin-standard": "^1.3.2",
48
- "eslint-plugin-vue": "^0.1.1",
49
- "eventsource-polyfill": "^0.9.6",
50
- "express": "^4.13.3",
51
- "extract-text-webpack-plugin": "^1.0.1",
52
- "file-loader": "^0.8.4",
53
- "function-bind": "^1.0.2",
54
- "html-webpack-plugin": "^2.8.1",
55
- "http-proxy-middleware": "^0.11.0",
56
- "inject-loader": "^2.0.1",
57
- "isparta-loader": "^2.0.0",
58
- "jasmine-core": "^2.4.1",
59
- "jquery": "^3.3.1",
60
- "jsencrypt": "^3.0.0-rc.1",
61
- "json-loader": "^0.5.4",
62
- "karma": "^1.4.1",
63
- "karma-chrome-launcher": "^2.2.0",
64
- "karma-coverage": "^1.1.1",
65
- "karma-mocha": "^1.3.0",
66
- "karma-sinon-chai": "^1.3.1",
67
- "karma-sourcemap-loader": "^0.3.7",
68
- "karma-spec-reporter": "0.0.31",
69
- "karma-webpack": "^2.0.2",
70
- "manage-client": "^1.4.20",
71
- "mkdirp": "^0.5.1",
72
- "mocha": "^3.2.0",
73
- "ncp": "^2.0.0",
74
- "nightwatch": "^0.8.18",
75
- "rimraf": "^2.5.0",
76
- "selenium-server": "2.52.0",
77
- "sinon": "^2.1.0",
78
- "sinon-chai": "^2.8.0",
79
- "style": "0.0.3",
80
- "style-loader": "^0.20.3",
81
- "url-loader": "^0.5.7",
82
- "vue-client": "1.24.107-test",
83
- "vue-hot-reload-api": "^1.2.0",
84
- "vue-html-loader": "^1.0.0",
85
- "vue-loader": "^8.2.1",
86
- "vue-resource": "^1.5.0",
87
- "vue-router": "^0.7.13",
88
- "vue-strap": "^1.0.9",
89
- "vue-style-loader": "^1.0.0",
90
- "vue-validator": "2.1.7",
91
- "webpack": "^1.12.2",
92
- "webpack-dev-middleware": "^1.4.0",
93
- "webpack-hot-middleware": "^2.6.0",
94
- "webpack-merge": "^0.8.3"
95
- },
96
- "repository": {
97
- "type": "git",
98
- "url": "https://gitee.com/aotu/System"
99
- },
100
- "keywords": [
101
- "system_clients"
102
- ],
103
- "author": "杨文宇",
104
- "license": "ISC"
105
- }
1
+ {
2
+ "name": "system-clients",
3
+ "version": "3.3.3-v3-t2",
4
+ "description": "系统基础框架",
5
+ "main": "src/index.js",
6
+ "directories": {
7
+ "doc": "doc",
8
+ "example": "examples",
9
+ "test": "test"
10
+ },
11
+ "scripts": {
12
+ "example": "node build/example-server.js",
13
+ "dev": "node build/dev-server.js",
14
+ "lint": "eslint src/**.js test/e2e/**.js test/unit/specs/** build/**.js",
15
+ "build": "rimraf dist && mkdirp dist && ncp static dist/static && cross-env NODE_ENV=production webpack --progress --hide-modules --config build/webpack.prod.conf.js",
16
+ "e2e": "node test/e2e/runner.js",
17
+ "unit": "karma start test/unit/karma.conf.js",
18
+ "makeall": "rimraf dist && mkdirp dist && ncp static dist/static && cross-env NODE_OPTIONS=--max_old_space_size=4096 NODE_ENV=production webpack --progress --hide-modules --config build/webpack.example.conf.js",
19
+ "release": "npm set registry http://registry.npmjs.org && npm publish && npm set registry http://registry.npm.taobao.org"
20
+ },
21
+ "dependencies": {
22
+ "base64-js": "^1.3.0",
23
+ "js-base64": "^2.4.9",
24
+ "less": "^2.7.1",
25
+ "less-loader": "^2.2.3",
26
+ "nyc": "^15.1.0",
27
+ "src": "^1.1.2",
28
+ "vue": "^1.0.17"
29
+ },
30
+ "devDependencies": {
31
+ "babel-core": "^6.0.0",
32
+ "babel-loader": "^6.0.0",
33
+ "babel-plugin-transform-runtime": "^6.0.0",
34
+ "babel-preset-es2015": "^6.0.0",
35
+ "babel-preset-stage-2": "^6.0.0",
36
+ "chai": "^3.5.0",
37
+ "connect-history-api-fallback": "^1.1.0",
38
+ "cross-env": "^1.0.7",
39
+ "cross-spawn": "^2.1.5",
40
+ "css-loader": "^0.23.0",
41
+ "eslint": "^2.0.0",
42
+ "eslint-config-standard": "^5.1.0",
43
+ "eslint-friendly-formatter": "^1.2.2",
44
+ "eslint-loader": "^1.3.0",
45
+ "eslint-plugin-html": "^1.3.0",
46
+ "eslint-plugin-promise": "^1.0.8",
47
+ "eslint-plugin-standard": "^1.3.2",
48
+ "eslint-plugin-vue": "^0.1.1",
49
+ "eventsource-polyfill": "^0.9.6",
50
+ "express": "^4.13.3",
51
+ "extract-text-webpack-plugin": "^1.0.1",
52
+ "file-loader": "^0.8.4",
53
+ "function-bind": "^1.0.2",
54
+ "html-webpack-plugin": "^2.8.1",
55
+ "http-proxy-middleware": "^0.11.0",
56
+ "inject-loader": "^2.0.1",
57
+ "isparta-loader": "^2.0.0",
58
+ "jasmine-core": "^2.4.1",
59
+ "jquery": "^3.3.1",
60
+ "jsencrypt": "^3.0.0-rc.1",
61
+ "json-loader": "^0.5.4",
62
+ "karma": "^1.4.1",
63
+ "karma-chrome-launcher": "^2.2.0",
64
+ "karma-coverage": "^1.1.1",
65
+ "karma-mocha": "^1.3.0",
66
+ "karma-sinon-chai": "^1.3.1",
67
+ "karma-sourcemap-loader": "^0.3.7",
68
+ "karma-spec-reporter": "0.0.31",
69
+ "karma-webpack": "^2.0.2",
70
+ "manage-client": "^1.4.20",
71
+ "mkdirp": "^0.5.1",
72
+ "mocha": "^3.2.0",
73
+ "ncp": "^2.0.0",
74
+ "nightwatch": "^0.8.18",
75
+ "rimraf": "^2.5.0",
76
+ "selenium-server": "2.52.0",
77
+ "sinon": "^2.1.0",
78
+ "sinon-chai": "^2.8.0",
79
+ "style": "0.0.3",
80
+ "style-loader": "^0.20.3",
81
+ "url-loader": "^0.5.7",
82
+ "vue-client": "1.24.107-test",
83
+ "vue-hot-reload-api": "^1.2.0",
84
+ "vue-html-loader": "^1.0.0",
85
+ "vue-loader": "^8.2.1",
86
+ "vue-resource": "^1.5.0",
87
+ "vue-router": "^0.7.13",
88
+ "vue-strap": "^1.0.9",
89
+ "vue-style-loader": "^1.0.0",
90
+ "vue-validator": "2.1.7",
91
+ "webpack": "^1.12.2",
92
+ "webpack-dev-middleware": "^1.4.0",
93
+ "webpack-hot-middleware": "^2.6.0",
94
+ "webpack-merge": "^0.8.3"
95
+ },
96
+ "repository": {
97
+ "type": "git",
98
+ "url": "https://gitee.com/aotu/System"
99
+ },
100
+ "keywords": [
101
+ "system_clients"
102
+ ],
103
+ "author": "杨文宇",
104
+ "license": "ISC"
105
+ }
@@ -146,7 +146,7 @@ import $ from 'jquery'
146
146
  import Vue from 'vue'
147
147
  import {HttpResetClass} from 'vue-client'
148
148
  import {isPasswordModificationExpired} from '../Util'
149
-
149
+ import { isStrongPassword } from '../../util/password-validation'
150
150
  let daibanJson = require('../../util/Daiban.json')
151
151
 
152
152
 
@@ -193,7 +193,7 @@ let saveGen = function *(self) {
193
193
  }
194
194
  console.log(self.$login.depPrompt)
195
195
  // 弱口令验证(默认开启,跳转过来的不进行验证)
196
- if ((!self.otherLogin) && !(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?!.*(123|321|abc|cba))[a-zA-Z\d!@#$%^&*()_+-=<>?]{8,16}$/.test(self.model.password))) {
196
+ if ((!self.otherLogin) && !isStrongPassword(self.model.password)) {
197
197
  self.$showMessage('登录系统: 此账户的密码过于简单,请修改密码后重新登陆!!!', ['confirm']).then((res) => {
198
198
  self.modifyPwShow = true
199
199
  })
@@ -1,125 +1,196 @@
1
1
  <template>
2
2
  <div>
3
3
  <validator name="v">
4
- <modal :show.sync="show" v-ref:modal backdrop="false">
4
+ <modal :show.sync="show" v-ref:modal backdrop="false">
5
5
  <header slot="modal-header" class="modal-header">
6
6
  <button type="button" class="close" @click="rest"><span>&times;</span></button>
7
7
  <h4 class="modal-title">修改密码</h4>
8
8
  </header>
9
9
  <article slot="modal-body" class="modal-body modifystyle auto form-horizontal">
10
+ <div class="password-alert">
11
+ {{ passwordRuleHint }}
12
+ </div>
10
13
  <div class="has-feedback form-group"
11
14
  :class="{'has-warning':$v.password.required,'has-error': $v.password.required,
12
15
  'has-success':!$v.password.required}">
13
- <label for="password" class="col-sm-4 col-sm-offset-1 control-label">原始密码:&nbsp;&nbsp;</label>
14
- <div class="col-sm-4">
16
+ <label for="password" class="col-sm-3 control-label">原始密码</label>
17
+ <div class="col-sm-8 password-field-wrap">
15
18
  <input type="password" v-model="deliver.password" class="form-control" id="password" v-validate:password="{ required: true}">
16
19
  <span class="glyphicon glyphicon-ok form-control-feedback" v-if="!$v.password.required"></span>
17
- <span v-if="$v.password.required">不能为空</span>
20
+ <span class="field-error" v-if="$v.password.required">不能为空</span>
18
21
  </div>
19
22
  </div>
20
23
  <div class="has-feedback form-group"
21
- :class="{'has-warning':$v.newpassword.required,'has-error':($v.newpassword.numbersAndLetter8to16 || $v.newpassword.minlength)&& !$v.newpassword.required && !$v.newpassword.chinesePassword,
22
- 'has-success': !$v.newpassword.required && !$v.newpassword.numbersAndLetter8to16&&!$v.newpassword.minlength && !$v.newpassword.chinesePassword}">
23
- <label for="newpassword" class="col-sm-4 col-sm-offset-1 control-label">新的密码:&nbsp;&nbsp;</label>
24
- <div class="col-sm-4">
25
- <input type="password" v-model="deliver.newpassword" class="form-control" id="newpassword" v-validate:newpassword='{required:true, numbersAndLetter8to16: true, minlength: 6,chinesePassword: true}'>
26
- <span class="glyphicon glyphicon-ok form-control-feedback" v-if="!$v.newpassword.required && !$v.newpassword.minlength && !($v.newpassword.numbersAndLetter8to16 && !($v.newpassword.required)) && !($v.newpassword.chinesePassword) "></span>
27
- <span v-if="$v.newpassword.required">不能为空</span>
28
- <span v-if="($v.newpassword.numbersAndLetter8to16||$v.newpassword.minlength) && !($v.newpassword.required&&$v.newpassword.minlength)">密码必须是8~16位数字与大小字母外加特殊字符的组合,并且不能出现类似'123','abc'等连贯数字或者字母</span>
29
- <span v-if="$v.newpassword.chinesePassword">密码不能包含中文</span>
24
+ :class="{'has-warning':$v.newpassword.required,'has-error':($v.newpassword.numbersAndLetter8to16 || $v.newpassword.chinesePassword) && !$v.newpassword.required,
25
+ 'has-success': !$v.newpassword.required && !$v.newpassword.numbersAndLetter8to16 && !$v.newpassword.chinesePassword}">
26
+ <label for="newpassword" class="col-sm-3 control-label">新的密码</label>
27
+ <div class="col-sm-8 password-field-wrap">
28
+ <input type="password" v-model="deliver.newpassword" class="form-control" id="newpassword" v-validate:newpassword='{required:true, numbersAndLetter8to16: true, chinesePassword: true}'>
29
+ <span class="glyphicon glyphicon-ok form-control-feedback" v-if="!$v.newpassword.required && !$v.newpassword.numbersAndLetter8to16 && !$v.newpassword.chinesePassword"></span>
30
+ <span class="field-error" v-if="$v.newpassword.required">不能为空</span>
31
+ <span class="field-error" v-if="$v.newpassword.chinesePassword && !$v.newpassword.required">密码不能包含中文</span>
32
+ <div v-if="passwordStrength.visible" class="password-strength">
33
+ <span class="strength-label">密码强度</span>
34
+ <span class="strength-tag" :class="passwordStrength.type">{{ passwordStrength.label }}</span>
35
+ <span class="strength-desc">{{ passwordStrength.desc }}</span>
36
+ </div>
30
37
  </div>
31
38
  </div>
32
39
  <div class="has-feedback form-group"
33
40
  :class="{'has-warning':$v.affirmpassword.required,'has-error':$v.affirmpassword.equalValid && !($v.affirmpassword.required),
34
41
  'has-success': !$v.affirmpassword.required && !($v.affirmpassword.equalValid && !($v.affirmpassword.required))}">
35
- <label for="affirmpassword" class="col-sm-4 col-sm-offset-1 control-label">确认密码:&nbsp;&nbsp;</label>
36
- <div class="col-sm-4">
42
+ <label for="affirmpassword" class="col-sm-3 control-label">确认密码</label>
43
+ <div class="col-sm-8 password-field-wrap">
37
44
  <input type="password" v-model="deliver.affirmpassword" class="form-control" id="affirmpassword" v-validate:affirmpassword="{ required: true, equalValid: deliver.newpassword }">
38
45
  <span class="glyphicon glyphicon-ok form-control-feedback" v-if="!$v.affirmpassword.required && !($v.affirmpassword.equalValid && !($v.affirmpassword.required))"></span>
39
- <span v-if="$v.affirmpassword.required">不能为空</span>
40
- <span v-if="$v.affirmpassword.equalValid && !($v.affirmpassword.required)">两次密码不一致 !!</span>
46
+ <span class="field-error" v-if="$v.affirmpassword.required">不能为空</span>
47
+ <span class="field-error" v-if="$v.affirmpassword.equalValid && !($v.affirmpassword.required)">两次密码不一致</span>
41
48
  </div>
42
49
  </div>
43
50
  </article>
44
51
 
45
52
  <footer slot="modal-footer" class="modal-footer">
46
- <button type="button" class="btn btn-success" @click='confirm' :disabled="!$v.valid">确认</button>
47
- <button type="button" class="btn btn-default" @click='rest'>取消</button>
53
+ <button type="button" class="btn btn-success" @click='confirm' :disabled="!$v.valid">确认</button>
54
+ <button type="button" class="btn btn-default" @click='rest'>取消</button>
48
55
  </footer>
49
56
  </modal>
50
57
  </validator>
51
58
  </div>
52
-
53
-
54
59
  </template>
55
60
  <script>
56
- import co from 'co'
57
- import validator from '../../plugins/validation';
61
+ import co from 'co'
62
+ import validator from '../../plugins/validation'
63
+ import { getPasswordStrength, PASSWORD_RULE_HINT } from '../../util/password-validation'
58
64
 
59
- let saveGen = function * (self) {
60
- self.deliver.ename = self.functions.ename
61
- // let res = yield self.$post('rs/user/entity', {data: self.deliver})
62
- // let res = yield self.$post('rs/db/modifypassword', {data: self.deliver})
63
- // let res = yield self.$resetpost('/rs/db/modifypwd', {data: self.deliver})
64
- // Util.f.password = self.deliver.newpassword
65
- let res = yield self.$resetpost('/rs/user/modifypwd', {data: self.deliver }, {resolveMsg: null,rejectMsg: null})
66
- self.$login.f.password = self.deliver.newpassword
67
- if (res.data) {
68
- console.log("修改密码返回:" , res.data)
69
- // 兼容旧版ldao,旧版不返回code
70
- if (res.data.code === 200) {
71
- self.deliver.password = ''
72
- self.deliver.newpassword = ''
73
- self.deliver.affirmpassword = ''
74
- self.show = false
75
- self.$showAlert("修改密码成功", 'success', 2000)
76
- } else {
77
- // 兼容旧版ldao,旧版不返回code
78
- self.deliver.password = ''
79
- self.deliver.newpassword = ''
80
- self.deliver.affirmpassword = ''
81
- self.show = false
82
- self.$showAlert("修改密码成功", 'success', 2000)
83
- }
65
+ let saveGen = function * (self) {
66
+ self.deliver.ename = self.functions.ename
67
+ let res = yield self.$resetpost('/rs/user/modifypwd', {data: self.deliver }, {resolveMsg: null,rejectMsg: null})
68
+ self.$login.f.password = self.deliver.newpassword
69
+ if (res.data) {
70
+ if (res.data.code === 200) {
71
+ self.deliver.password = ''
72
+ self.deliver.newpassword = ''
73
+ self.deliver.affirmpassword = ''
74
+ self.show = false
75
+ self.$showAlert("修改密码成功", 'success', 2000)
84
76
  } else {
85
- if (res.data.code) {
86
- self.$showAlert("修改密码失败,原因:" + res.data.msg, 'warning', 2000)
87
- } else {
88
- self.$showMessage(res.data)
89
- }
77
+ self.deliver.password = ''
78
+ self.deliver.newpassword = ''
79
+ self.deliver.affirmpassword = ''
80
+ self.show = false
81
+ self.$showAlert("修改密码成功", 'success', 2000)
82
+ }
83
+ } else {
84
+ if (res.data.code) {
85
+ self.$showAlert("修改密码失败,原因:" + res.data.msg, 'warning', 2000)
86
+ } else {
87
+ self.$showMessage(res.data)
90
88
  }
91
89
  }
92
- export default {
93
- title: '系统管理-密码修改',
94
- data () {
95
- return {
96
- deliver: {
97
- password: '',
98
- newpassword: '',
99
- affirmpassword: ''
100
- },
101
- functions: this.$login.f
102
- }
103
- },
104
- props: ['show'],
105
- methods: {
106
- confirm () {
107
- let gen = saveGen(this)
108
- co(gen)
90
+ }
91
+ export default {
92
+ title: '系统管理-密码修改',
93
+ data () {
94
+ return {
95
+ deliver: {
96
+ password: '',
97
+ newpassword: '',
98
+ affirmpassword: ''
109
99
  },
110
- rest () {
111
- this.show = false
112
- this.deliver = {password: '', newpassword: '', affirmpassword: ''}
113
- }
100
+ functions: this.$login.f,
101
+ passwordRuleHint: PASSWORD_RULE_HINT
102
+ }
103
+ },
104
+ computed: {
105
+ passwordStrength () {
106
+ return getPasswordStrength(this.deliver.newpassword)
107
+ }
108
+ },
109
+ props: ['show'],
110
+ methods: {
111
+ confirm () {
112
+ let gen = saveGen(this)
113
+ co(gen)
114
+ },
115
+ rest () {
116
+ this.show = false
117
+ this.deliver = {password: '', newpassword: '', affirmpassword: ''}
114
118
  }
115
119
  }
120
+ }
116
121
  </script>
117
122
  <style>
118
- /*修改密码body界面样式*/
119
- .modifystyle {
120
- background: #FCFEEE;
121
- }
122
- .modifystyle span{
123
- color: red;
124
- }
123
+ .modifystyle {
124
+ background: #fff;
125
+ padding: 10px 20px 20px;
126
+ }
127
+
128
+ .modifystyle .control-label {
129
+ color: #333;
130
+ font-weight: normal;
131
+ padding-top: 7px;
132
+ }
133
+
134
+ .password-field-wrap {
135
+ padding-left: 0;
136
+ padding-right: 0;
137
+ }
138
+
139
+ .password-field-wrap .form-control {
140
+ width: 100%;
141
+ }
142
+
143
+ .password-alert {
144
+ margin: 0 0 16px;
145
+ padding: 10px 12px;
146
+ border-radius: 4px;
147
+ background: #f5f7fa;
148
+ border: 1px solid #e4e7ed;
149
+ color: #606266;
150
+ font-size: 13px;
151
+ line-height: 1.6;
152
+ }
153
+
154
+ .field-error {
155
+ display: block;
156
+ margin-top: 6px;
157
+ color: #e74c3c;
158
+ font-size: 12px;
159
+ line-height: 1.4;
160
+ }
161
+
162
+ .password-strength {
163
+ margin-top: 8px;
164
+ font-size: 12px;
165
+ line-height: 1.6;
166
+ color: #606266;
167
+ }
168
+
169
+ .password-strength .strength-label {
170
+ margin-right: 6px;
171
+ color: #909399;
172
+ }
173
+
174
+ .password-strength .strength-tag {
175
+ display: inline-block;
176
+ margin-right: 8px;
177
+ padding: 1px 8px;
178
+ border-radius: 3px;
179
+ font-size: 12px;
180
+ line-height: 1.5;
181
+ }
182
+
183
+ .password-strength .strength-tag.success {
184
+ color: #2e7d32;
185
+ background: #e8f5e9;
186
+ }
187
+
188
+ .password-strength .strength-tag.error {
189
+ color: #c62828;
190
+ background: #ffebee;
191
+ }
192
+
193
+ .password-strength .strength-desc {
194
+ color: #606266;
195
+ }
125
196
  </style>
@@ -146,7 +146,7 @@ import $ from 'jquery'
146
146
  import Vue from 'vue'
147
147
  import {HttpResetClass} from 'vue-client'
148
148
  import {isPasswordModificationExpired} from '../../components/Util'
149
-
149
+ import { isStrongPassword } from '../../util/password-validation'
150
150
  let daibanJson = require('../../util/Daiban.json')
151
151
 
152
152
 
@@ -206,7 +206,7 @@ let saveGen = function *(self) {
206
206
  }
207
207
  console.log(self.$login.depPrompt)
208
208
  // 弱口令验证(默认开启,跳转过来的不进行验证)
209
- if ((!self.otherLogin) && !(/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$/.test(self.model.password))) {
209
+ if ((!self.otherLogin) && !isStrongPassword(self.model.password)) {
210
210
  self.$showMessage('登录系统: 此账户的密码过于简单,请修改密码后重新登陆!!!', ['confirm']).then((res) => {
211
211
  self.modifyPwShow = true
212
212
  })
@@ -144,7 +144,7 @@ import $ from 'jquery'
144
144
  import Vue from 'vue'
145
145
  import {HttpResetClass} from 'vue-client'
146
146
  import {isPasswordModificationExpired} from '../../components/Util'
147
-
147
+ import { isStrongPassword } from '../../util/password-validation'
148
148
  let daibanJson = require('../../util/Daiban.json')
149
149
 
150
150
 
@@ -204,7 +204,7 @@ let saveGen = function *(self) {
204
204
  }
205
205
  console.log(self.$login.depPrompt)
206
206
  // 弱口令验证(默认开启,跳转过来的不进行验证)
207
- if ((!self.otherLogin) && !(/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$/.test(self.model.password))) {
207
+ if ((!self.otherLogin) && !isStrongPassword(self.model.password)) {
208
208
  self.$showMessage('登录系统: 此账户的密码过于简单,请修改密码后重新登陆!!!', ['confirm']).then((res) => {
209
209
  self.modifyPwShow = true
210
210
  })
@@ -150,7 +150,7 @@ import $ from 'jquery'
150
150
  import Vue from 'vue'
151
151
  import {HttpResetClass} from 'vue-client'
152
152
  import {isPasswordModificationExpired} from '../../components/Util'
153
-
153
+ import { isStrongPassword } from '../../util/password-validation'
154
154
  let daibanJson = require('../../util/Daiban.json')
155
155
 
156
156
 
@@ -210,7 +210,7 @@ let saveGen = function *(self) {
210
210
  }
211
211
  console.log(self.$login.depPrompt)
212
212
  // 弱口令验证(默认开启,跳转过来的不进行验证)
213
- if ((!self.otherLogin) && !(/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$/.test(self.model.password))) {
213
+ if ((!self.otherLogin) && !isStrongPassword(self.model.password)) {
214
214
  self.$showMessage('登录系统: 此账户的密码过于简单,请修改密码后重新登陆!!!', ['confirm']).then((res) => {
215
215
  self.modifyPwShow = true
216
216
  })
@@ -137,7 +137,7 @@ import $ from 'jquery'
137
137
  import Vue from 'vue'
138
138
  import {HttpResetClass} from 'vue-client'
139
139
  import {isPasswordModificationExpired} from '../../components/Util'
140
-
140
+ import { isStrongPassword } from '../../util/password-validation'
141
141
  let daibanJson = require('../../util/Daiban.json')
142
142
 
143
143
 
@@ -197,7 +197,7 @@ let saveGen = function *(self) {
197
197
  }
198
198
  console.log(self.$login.depPrompt)
199
199
  // 弱口令验证(默认开启,跳转过来的不进行验证)
200
- if ((!self.otherLogin) && !(/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$/.test(self.model.password))) {
200
+ if ((!self.otherLogin) && !isStrongPassword(self.model.password)) {
201
201
  self.$showMessage('登录系统: 此账户的密码过于简单,请修改密码后重新登陆!!!', ['confirm']).then((res) => {
202
202
  self.modifyPwShow = true
203
203
  })
@@ -135,7 +135,7 @@
135
135
  import Vue from 'vue'
136
136
  import {HttpResetClass} from 'vue-client'
137
137
  import {isPasswordModificationExpired} from '../../components/Util'
138
-
138
+ import { isStrongPassword } from '../../util/password-validation'
139
139
 
140
140
 
141
141
  let saveGen = function *(self) {
@@ -193,7 +193,7 @@
193
193
  }
194
194
  console.log(self.$login.depPrompt)
195
195
  // 弱口令验证(默认开启,跳转过来的不进行验证)
196
- if ((!self.otherLogin) && !(/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$/.test(self.model.password))) {
196
+ if ((!self.otherLogin) && !isStrongPassword(self.model.password)) {
197
197
  self.$showMessage('登录系统: 此账户的密码过于简单,请修改密码后重新登陆!!!', ['confirm']).then((res) => {
198
198
  self.modifyPwShow = true
199
199
  })
@@ -147,7 +147,7 @@ import Vue from 'vue'
147
147
  import {HttpResetClass} from 'vue-client'
148
148
  import {isPasswordModificationExpired} from '../../components/Util'
149
149
  import cryptJS from "../../plugins/EncryptUtil";
150
-
150
+ import { isStrongPassword } from '../../util/password-validation'
151
151
  let daibanJson = require('../../util/Daiban.json')
152
152
 
153
153
 
@@ -206,7 +206,7 @@ let saveGen = function *(self) {
206
206
  }
207
207
  console.log(self.$login.depPrompt)
208
208
  // 弱口令验证(默认开启,跳转过来的不进行验证)
209
- if ((!self.otherLogin) && !(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?!.*(.)(\1)+)(?!.*(123|321|abc|cba))[a-zA-Z\d!@#$%^&*()_+-=<>?]{8,16}$/.test(self.model.password))) {
209
+ if ((!self.otherLogin) && !isStrongPassword(self.model.password)) {
210
210
  self.$showMessage('登录系统: 此账户的密码过于简单,请修改密码后重新登陆!!!', ['confirm']).then((res) => {
211
211
  self.modifyPwShow = true
212
212
  })
@@ -125,8 +125,7 @@ import $ from 'jquery'
125
125
  import Vue from 'vue'
126
126
  import {HttpResetClass} from 'vue-client'
127
127
  import {isPasswordModificationExpired} from '../../components/Util'
128
-
129
-
128
+ import { isStrongPassword } from '../../util/password-validation'
130
129
 
131
130
  let saveGen = function *(self) {
132
131
  try {
@@ -184,7 +183,7 @@ let saveGen = function *(self) {
184
183
  }
185
184
  console.log(self.$login.depPrompt)
186
185
  // 弱口令验证(默认开启,跳转过来的不进行验证)
187
- if ((!self.otherLogin) && !(/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$/.test(self.model.password))) {
186
+ if ((!self.otherLogin) && !isStrongPassword(self.model.password)) {
188
187
  self.$showMessage('登录系统: 此账户的密码过于简单,请修改密码后重新登陆!!!', ['confirm']).then((res) => {
189
188
  self.modifyPwShow = true
190
189
  })
@@ -146,7 +146,7 @@
146
146
  import Vue from 'vue'
147
147
  import {HttpResetClass} from 'vue-client'
148
148
  import {isPasswordModificationExpired} from '../../components/Util'
149
-
149
+ import { isStrongPassword } from '../../util/password-validation'
150
150
  let daibanJson = require('../../util/Daiban.json')
151
151
 
152
152
 
@@ -205,7 +205,7 @@
205
205
  }
206
206
  console.log(self.$login.depPrompt)
207
207
  // 弱口令验证(默认开启,跳转过来的不进行验证)
208
- if ((!self.otherLogin) && !(/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$/.test(self.model.password))) {
208
+ if ((!self.otherLogin) && !isStrongPassword(self.model.password)) {
209
209
  self.$showMessage('登录系统: 此账户的密码过于简单,请修改密码后重新登陆!!!', ['confirm']).then((res) => {
210
210
  self.modifyPwShow = true
211
211
  })
@@ -149,7 +149,7 @@ import $ from 'jquery'
149
149
  import Vue from 'vue'
150
150
  import {HttpResetClass} from 'vue-client'
151
151
  import {isPasswordModificationExpired} from '../../components/Util'
152
-
152
+ import { isStrongPassword } from '../../util/password-validation'
153
153
  let daibanJson = require('../../util/Daiban.json')
154
154
 
155
155
 
@@ -209,7 +209,7 @@ let saveGen = function *(self) {
209
209
  }
210
210
  console.log(self.$login.depPrompt)
211
211
  // 弱口令验证(默认开启,跳转过来的不进行验证)
212
- if ((!self.otherLogin) && !(/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$/.test(self.model.password))) {
212
+ if ((!self.otherLogin) && !isStrongPassword(self.model.password)) {
213
213
  self.$showMessage('登录系统: 此账户的密码过于简单,请修改密码后重新登陆!!!', ['confirm']).then((res) => {
214
214
  self.modifyPwShow = true
215
215
  })
@@ -142,7 +142,7 @@ import $ from 'jquery'
142
142
  import Vue from 'vue'
143
143
  import {HttpResetClass} from 'vue-client'
144
144
  import {isPasswordModificationExpired} from '../../components/Util'
145
-
145
+ import { isStrongPassword } from '../../util/password-validation'
146
146
  let daibanJson = require('../../util/Daiban.json')
147
147
 
148
148
 
@@ -202,7 +202,7 @@ let saveGen = function *(self) {
202
202
  }
203
203
  console.log(self.$login.depPrompt)
204
204
  // 弱口令验证(默认开启,跳转过来的不进行验证)
205
- if ((!self.otherLogin) && !(/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$/.test(self.model.password))) {
205
+ if ((!self.otherLogin) && !isStrongPassword(self.model.password)) {
206
206
  self.$showMessage('登录系统: 此账户的密码过于简单,请修改密码后重新登陆!!!', ['confirm']).then((res) => {
207
207
  self.modifyPwShow = true
208
208
  })
@@ -142,7 +142,7 @@ import $ from 'jquery'
142
142
  import Vue from 'vue'
143
143
  import {HttpResetClass} from 'vue-client'
144
144
  import {isPasswordModificationExpired} from '../../components/Util'
145
-
145
+ import { isStrongPassword } from '../../util/password-validation'
146
146
  let daibanJson = require('../../util/Daiban.json')
147
147
 
148
148
 
@@ -202,7 +202,7 @@ let saveGen = function *(self) {
202
202
  }
203
203
  console.log(self.$login.depPrompt)
204
204
  // 弱口令验证(默认开启,跳转过来的不进行验证)
205
- if ((!self.otherLogin) && !(/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$/.test(self.model.password))) {
205
+ if ((!self.otherLogin) && !isStrongPassword(self.model.password)) {
206
206
  self.$showMessage('登录系统: 此账户的密码过于简单,请修改密码后重新登陆!!!', ['confirm']).then((res) => {
207
207
  self.modifyPwShow = true
208
208
  })
@@ -141,7 +141,7 @@ import $ from 'jquery'
141
141
  import Vue from 'vue'
142
142
  import {HttpResetClass} from 'vue-client'
143
143
  import {isPasswordModificationExpired} from '../../components/Util'
144
-
144
+ import { isStrongPassword } from '../../util/password-validation'
145
145
  let daibanJson = require('../../util/Daiban.json')
146
146
 
147
147
 
@@ -201,7 +201,7 @@ let saveGen = function *(self) {
201
201
  }
202
202
  console.log(self.$login.depPrompt)
203
203
  // 弱口令验证(默认开启,跳转过来的不进行验证)
204
- if ((!self.otherLogin) && !(/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$/.test(self.model.password))) {
204
+ if ((!self.otherLogin) && !isStrongPassword(self.model.password)) {
205
205
  self.$showMessage('登录系统: 此账户的密码过于简单,请修改密码后重新登陆!!!', ['confirm']).then((res) => {
206
206
  self.modifyPwShow = true
207
207
  })
@@ -1,15 +1,19 @@
1
1
  import Vue from 'vue'
2
2
  import Validator from 'vue-validator'
3
+ import { isStrongPassword } from '../util/password-validation'
4
+
3
5
  Vue.use(Validator)
4
- //密码强度验证器(必须为为大小写字母、阿拉伯数字、字符)
6
+
7
+ // 密码强度验证器(必须为大小写字母、阿拉伯数字、特殊字符)
5
8
  Vue.validator('strongpassword', function (val) {
6
- return /^(?:(?=.*[a-zA-Z])(?=.*[0-9])(?=.*[^A-Za-z0-9])).*$/.test(val)
7
- });
9
+ return isStrongPassword(val)
10
+ })
11
+
8
12
  Vue.validator('chinesePassword', function (val) {
9
- var testBealoon=/.*?[\u4E00-\u9FFF]+.*$/.test(val)
10
13
  return !(/.*?[\u4E00-\u9FFF]+.*$/.test(val))
11
- });
12
- // 潜能要求8~16位数字字母组合;
14
+ })
15
+
16
+ // 强密码校验:12-16位,含大小写、数字、特殊字符,并排除常见弱口令与连续模式
13
17
  Vue.validator('numbersAndLetter8to16', function (val) {
14
- return /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?!.*(123|321|abc|cba))[a-zA-Z\d!@#$%^&*()_+-=<>?]{8,16}$/.test(val)
15
- });
18
+ return isStrongPassword(val)
19
+ })
@@ -0,0 +1,185 @@
1
+ const REG_STRONG_PWD =
2
+ /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*(),.?":{}|<>~`+=_\\-])[A-Za-z\d!@#$%^&*(),.?":{}|<>~`+=_\\-]{12,16}$/
3
+
4
+ const COMMON_PASSWORDS = [
5
+ 'password',
6
+ 'password123',
7
+ '123456',
8
+ '12345678',
9
+ 'qwerty',
10
+ 'abc123',
11
+ 'Password1',
12
+ 'password1',
13
+ '123456789',
14
+ 'welcome',
15
+ 'admin',
16
+ 'letmein',
17
+ 'monkey',
18
+ 'dragon',
19
+ 'master',
20
+ 'superman',
21
+ 'qwerty123',
22
+ 'admin123',
23
+ 'root',
24
+ 'pass',
25
+ 'test',
26
+ 'guest',
27
+ 'user',
28
+ '000000',
29
+ '111111',
30
+ '666666',
31
+ '888888',
32
+ '999999',
33
+ 'iloveyou',
34
+ 'welcome123',
35
+ 'password!',
36
+ 'Passw0rd!',
37
+ 'Passw0rd',
38
+ 'Password!',
39
+ 'passw0rd',
40
+ 'P@ssw0rd',
41
+ 'P@ssword',
42
+ 'Password@123'
43
+ ]
44
+
45
+ export const PASSWORD_RULE_HINT = '密码长度须为 12-16 位,包含大小写字母、数字与特殊符号。'
46
+
47
+ export const PASSWORD_DEFAULT_ERROR = '新密码必须包含大小写字母、数字和特殊字符,且长度为12-16位'
48
+
49
+ function hasConsecutiveNumbers (password) {
50
+ for (let i = 0; i <= password.length - 3; i++) {
51
+ const substr = password.substring(i, i + 3)
52
+ if (/^\d{3,}$/.test(substr)) {
53
+ const digits = substr.split('').map(Number)
54
+ let isConsecutive = true
55
+ for (let j = 1; j < digits.length; j++) {
56
+ if (digits[j] !== digits[j - 1] + 1) {
57
+ isConsecutive = false
58
+ break
59
+ }
60
+ }
61
+ if (isConsecutive) return true
62
+ }
63
+ }
64
+ return false
65
+ }
66
+
67
+ function hasConsecutiveLetters (password) {
68
+ const lowerPassword = password.toLowerCase()
69
+ for (let i = 0; i <= lowerPassword.length - 3; i++) {
70
+ const substr = lowerPassword.substring(i, i + 3)
71
+ if (/^[a-z]{3,}$/.test(substr)) {
72
+ let isConsecutive = true
73
+ for (let j = 1; j < substr.length; j++) {
74
+ if (substr.charCodeAt(j) !== substr.charCodeAt(j - 1) + 1) {
75
+ isConsecutive = false
76
+ break
77
+ }
78
+ }
79
+ if (isConsecutive) return true
80
+ }
81
+ }
82
+ return false
83
+ }
84
+
85
+ function hasRepeatedChars (password) {
86
+ return /(.)\1{2,}/.test(password)
87
+ }
88
+
89
+ function hasKeyboardPattern (password) {
90
+ const keyboardRows = ['qwertyuiop', 'asdfghjkl', 'zxcvbnm', '1234567890']
91
+ const lowerPassword = password.toLowerCase()
92
+
93
+ for (const row of keyboardRows) {
94
+ for (let i = 0; i <= row.length - 3; i++) {
95
+ const pattern = row.substring(i, i + 3)
96
+ if (lowerPassword.includes(pattern)) {
97
+ return true
98
+ }
99
+ }
100
+ }
101
+ return false
102
+ }
103
+
104
+ export function validateStrongPassword (password) {
105
+ const result = {
106
+ isValid: true,
107
+ errors: []
108
+ }
109
+
110
+ if (!password) {
111
+ result.isValid = false
112
+ result.errors.push('不能为空')
113
+ return result
114
+ }
115
+
116
+ if (!REG_STRONG_PWD.test(password)) {
117
+ result.isValid = false
118
+ result.errors.push('密码长度须为12-16位,且包含大写字母、小写字母、数字和特殊字符')
119
+ return result
120
+ }
121
+
122
+ if (COMMON_PASSWORDS.includes(password) || COMMON_PASSWORDS.includes(password.toLowerCase())) {
123
+ result.isValid = false
124
+ result.errors.push('不能使用常见密码')
125
+ return result
126
+ }
127
+
128
+ if (hasConsecutiveNumbers(password)) {
129
+ result.isValid = false
130
+ result.errors.push('不能包含连续数字')
131
+ return result
132
+ }
133
+
134
+ if (hasConsecutiveLetters(password)) {
135
+ result.isValid = false
136
+ result.errors.push('不能包含连续字母')
137
+ return result
138
+ }
139
+
140
+ if (hasRepeatedChars(password)) {
141
+ result.isValid = false
142
+ result.errors.push('不能包含3个或以上相同字符')
143
+ return result
144
+ }
145
+
146
+ if (hasKeyboardPattern(password)) {
147
+ result.isValid = false
148
+ result.errors.push('不能包含键盘连续按键模式')
149
+ return result
150
+ }
151
+
152
+ return result
153
+ }
154
+
155
+ export function isStrongPassword (password) {
156
+ return validateStrongPassword(password).isValid
157
+ }
158
+
159
+ export function getPasswordStrength (password) {
160
+ if (!password) {
161
+ return {
162
+ label: '未输入',
163
+ type: 'default',
164
+ desc: '请输入密码以查看强度',
165
+ visible: false
166
+ }
167
+ }
168
+
169
+ const { isValid, errors } = validateStrongPassword(password)
170
+ if (isValid) {
171
+ return {
172
+ label: '强',
173
+ type: 'success',
174
+ desc: '密码满足复杂度要求',
175
+ visible: true
176
+ }
177
+ }
178
+
179
+ return {
180
+ label: '弱',
181
+ type: 'error',
182
+ desc: errors[0] || '密码不满足安全要求',
183
+ visible: true
184
+ }
185
+ }