[MICROBA-1179] - Continue renaming/removal of code referring to the Certificate "white list". The Certificates Django app `CertificateWhitelist` model is going away in an effort to make our codebase more inclusive. It is being replaced with the `CertificateAllowlist` model. This PR continues to replace references to the Certificate "whitelist" with "allowlist" wherever possible. There should be no change in functionality, nor are there any changes in appearance.
39 lines
1.2 KiB
JavaScript
39 lines
1.2 KiB
JavaScript
// Backbone.js Application Model: CertificateAllowlist
|
|
/* global define, RequireJS */
|
|
|
|
(function(define) {
|
|
'use strict';
|
|
|
|
define([
|
|
'underscore',
|
|
'underscore.string',
|
|
'backbone',
|
|
'gettext'
|
|
],
|
|
|
|
function(_, str, Backbone, gettext) {
|
|
return Backbone.Model.extend({
|
|
idAttribute: 'id',
|
|
|
|
defaults: {
|
|
user_id: '',
|
|
user_name: '',
|
|
user_email: '',
|
|
created: '',
|
|
certificate_generated: '',
|
|
notes: ''
|
|
},
|
|
initialize: function(attributes, options) {
|
|
this.url = options.url;
|
|
},
|
|
validate: function(attrs) {
|
|
if (!str.trim(attrs.user_name) && !str.trim(attrs.user_email)) {
|
|
return gettext('Student username/email field is required and can not be empty. ' +
|
|
'Kindly fill in username/email and then press "Add to Exception List" button.');
|
|
}
|
|
}
|
|
});
|
|
}
|
|
);
|
|
}).call(this, define || RequireJS.define);
|