summaryrefslogtreecommitdiffstats
path: root/modules/luci-base/htdocs/luci-static/resources/tools/password.js
blob: 64b451c699802c839c5b922a39570ba58b16d6f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
'use strict';

'require baseclass';
'require uci';

return baseclass.extend({
	checkLength(p, required) {
		let enough = p.length >= parseInt(required);

		if (required && !enough)
			return false;

		return true;
	},

	checkDigits(p) {
		let m = p.match(/\d/);

		return m ? true : false;
	},

	checkUpperLower(p) {

		return /[a-z]/.test(p) && /[A-Z]/.test(p);
	},

	checkSpecialChars(p) {
		let m = p.match(/[^a-zA-Z0-9]/);

		return m ? true : false;
	}
});