2014-05-12 20:08:19 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
angular.module('ffffng').factory('Constraints', function () {
|
|
|
|
return {
|
2016-06-04 11:41:57 +02:00
|
|
|
id:{
|
|
|
|
regex: /^[1-9][0-9]*/,
|
|
|
|
optional: false
|
|
|
|
},
|
2014-05-12 20:08:19 +02:00
|
|
|
token:{
|
2014-12-31 13:46:10 +01:00
|
|
|
regex: /^[0-9a-f]{16}$/i,
|
2014-05-12 20:08:19 +02:00
|
|
|
optional: false
|
|
|
|
},
|
|
|
|
node: {
|
|
|
|
hostname: {
|
2014-12-31 13:46:10 +01:00
|
|
|
regex: /^[-a-z0-9_]{1,32}$/i,
|
2014-05-12 20:08:19 +02:00
|
|
|
optional: false
|
|
|
|
},
|
|
|
|
key: {
|
2014-12-31 13:46:10 +01:00
|
|
|
regex: /^([a-f0-9]{64})$/i,
|
2014-05-12 20:08:19 +02:00
|
|
|
optional: true
|
|
|
|
},
|
|
|
|
email: {
|
2014-12-31 13:46:10 +01:00
|
|
|
regex: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i,
|
2014-05-12 20:08:19 +02:00
|
|
|
optional: false
|
|
|
|
},
|
|
|
|
nickname: {
|
2014-12-31 13:46:10 +01:00
|
|
|
regex: /^[-a-z0-9_ äöüß]{1,64}$/i,
|
2014-05-12 20:08:19 +02:00
|
|
|
optional: false
|
|
|
|
},
|
|
|
|
mac: {
|
2014-12-31 13:46:10 +01:00
|
|
|
regex: /^([a-f0-9]{12}|([a-f0-9]{2}:){5}[a-f0-9]{2})$/i,
|
2014-05-12 20:08:19 +02:00
|
|
|
optional: false
|
|
|
|
},
|
|
|
|
coords: {
|
|
|
|
regex: /^(-?[0-9]{1,3}(\.[0-9]{1,15})? -?[0-9]{1,3}(\.[0-9]{1,15})?)$/,
|
|
|
|
optional: true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
});
|