]> www.vanbest.org Git - motioneye-debian/commitdiff
restrict admin password to some printable ascii characters
authorCalin Crisan <ccrisan@gmail.com>
Sun, 28 May 2017 11:13:39 +0000 (14:13 +0300)
committerCalin Crisan <ccrisan@gmail.com>
Sun, 28 May 2017 11:13:39 +0000 (14:13 +0300)
motioneye/scripts/relayevent.sh
motioneye/static/js/main.js

index c335870e63b6a8c77241ec05a06482aef9a9ac88..5130fb4192ff56cf5ebc2c749920242061a68826 100755 (executable)
@@ -15,7 +15,8 @@ if [ -f "$motioneye_conf" ]; then
         motion_conf="$conf_path/motion.conf"
         if [ -r "$motion_conf" ]; then
             username=$(cat $motion_conf | grep 'admin_username' | cut -d ' ' -f 3)
-            password=$(cat $motion_conf | grep 'admin_password' | cut -d ' ' -f 3 | sed -r 's/[^][a-zA-Z0-9\/?_.=&{}":, _]/-/g')
+            password=$(cat $motion_conf | grep 'admin_password' | cut -d ' ' -f 3 | sed -r 's/[^][a-zA-Z0-9/?_.=&{}":, _]/-/g')
+            echo "aa${password}aa" > /tmp/wtf
         fi
     fi
 fi
index ac473f2efefc7301d4b8a0cea05dd6cd15a16066..ac43386ada2b9951f0d546ee7f88a04a98f8f7c1 100644 (file)
@@ -569,6 +569,13 @@ function initUI() {
     makeTimeValidator($('input[type=text].time'));
     
     /* custom validators */
+    makeCustomValidator($('#adminPasswordEntry'), function (value) {
+        if (!value.toLowerCase().match(new RegExp('^[\x21-\x7F]*$'))) {
+            return "special characters are not allowed in admin password";
+        }
+        
+        return true;
+    }, '');
     makeCustomValidator($('#deviceNameEntry'), function (value) {
         if (!value) {
             return 'this field is required';