mirror of https://github.com/gophish/gophish
parent
9e376d0c11
commit
0c1d82ad46
|
@ -11,6 +11,16 @@ type Template struct {
|
||||||
ModifiedDate time.Time `json:"modified_date"`
|
ModifiedDate time.Time `json:"modified_date"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *Template) Validate() (string, bool) {
|
||||||
|
switch {
|
||||||
|
case t.Name == "":
|
||||||
|
return "Template Name not specified", false
|
||||||
|
case t.Text == "" && t.Html == "":
|
||||||
|
return "Need to specify at least plaintext or HTML format", false
|
||||||
|
}
|
||||||
|
return "", true
|
||||||
|
}
|
||||||
|
|
||||||
type UserTemplate struct {
|
type UserTemplate struct {
|
||||||
UserId int64 `json:"-"`
|
UserId int64 `json:"-"`
|
||||||
TemplateId int64 `json:"-"`
|
TemplateId int64 `json:"-"`
|
||||||
|
|
|
@ -41,7 +41,7 @@ app.directive('contenteditable', function() {
|
||||||
restrict: 'A', // only activate on element attribute
|
restrict: 'A', // only activate on element attribute
|
||||||
require: '?ngModel', // get a hold of NgModelCtrl
|
require: '?ngModel', // get a hold of NgModelCtrl
|
||||||
link: function(scope, element, attrs, ngModel) {
|
link: function(scope, element, attrs, ngModel) {
|
||||||
if(!ngModel) return; // do nothing if no ng-model
|
if (!ngModel) return; // do nothing if no ng-model
|
||||||
|
|
||||||
// Specify how UI should be updated
|
// Specify how UI should be updated
|
||||||
ngModel.$render = function() {
|
ngModel.$render = function() {
|
||||||
|
@ -54,15 +54,16 @@ app.directive('contenteditable', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Write data to the model
|
// Write data to the model
|
||||||
|
|
||||||
function read() {
|
function read() {
|
||||||
var html = element.html();
|
var html = element.html();
|
||||||
// When we clear the content editable the browser leaves a <br> behind
|
// When we clear the content editable the browser leaves a <br> behind
|
||||||
// If strip-br attribute is provided then we strip this out
|
// If strip-br attribute is provided then we strip this out
|
||||||
if( attrs.stripBr && html == '<br>' ) {
|
if (attrs.stripBr && html == '<br>') {
|
||||||
html = '';
|
html = '';
|
||||||
}
|
}
|
||||||
ngModel.$setViewValue(html);
|
ngModel.$setViewValue(html);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
Loading…
Reference in New Issue