Skip to content

Commit

Permalink
fixes #1340 - smtp server checks
Browse files Browse the repository at this point in the history
Added new jQuery validation plugin rule of type pattern
Checks for smtp server to be valid (no spaces, no starting with -,
no chars !=digits or letters, all lowercase)
  • Loading branch information
MFlyer committed Jul 26, 2016
1 parent 0f44a49 commit 16c1a7a
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/rockstor/storageadmin/static/storageadmin/js/views/email.js
Expand Up @@ -96,7 +96,10 @@ EmailView = RockstorLayoutView.extend({
name: 'required',
sender: 'required',
password: 'required',
smtp_server: 'required',
smtp_server: {
required: true,
pattern: /^(([a-z\d]|[a-z\d][a-z\d\-]*[a-z\d])\.)*([a-z\d]|[a-z\d][a-z\d\-]*[a-z\d])$/
},
receiver: 'required',
username: {
required: "#enable_username:checked" //username field required only if username checkbox checked else empty
Expand All @@ -105,6 +108,11 @@ EmailView = RockstorLayoutView.extend({
number: true
}
},
messages: {
smtp_server: {
pattern: 'Please provide a correct hostname with only lowercase letters, digits and -'
}
},

submitHandler: function() {
var button = $('#add-email');
Expand Down Expand Up @@ -246,4 +254,4 @@ EmailView = RockstorLayoutView.extend({
});

}
});
});

0 comments on commit 16c1a7a

Please sign in to comment.