diff --git a/.desktop/settings.json b/.desktop/settings.json index eb28927..d5d15b9 100644 --- a/.desktop/settings.json +++ b/.desktop/settings.json @@ -1,6 +1,6 @@ { "name": "communecter", - "version": "0.0.31", + "version": "0.0.33", "projectName": "communecter", "devTools": true, "devtron": true, @@ -21,14 +21,13 @@ "uglify": true, "plugins": { "meteor-desktop-splash-screen": { - "version": "0.3.0", + "version": "0.4.3", "imagePath": "splash.png", "windowSettings": { "width": 800, "height": 600 } }, - "meteor-desktop-localstorage": "0.0.11", "meteor-desktop-system-notifications": { "version": "0.0.2" } @@ -41,8 +40,6 @@ }, "builderOptions": { "win": { - "title": "communecter", - "authors": "Thomas Craipeau", "target": ["squirrel","nsis"] }, "squirrelWindows": { @@ -74,15 +71,15 @@ "_osx": { "icon": ".desktop/assets/icon.icns" }, - "version-string": { + "appVersion": "@version", + "buildVersion": "@version", + "appCopyright": "communecter", + "win32metadata": { "CompanyName": "communecter", - "LegalCopyright": "communecter.org", "FileDescription": "communecter", "OriginalFilename": "communecter.exe", - "FileVersion": "@version", - "ProductVersion": "@version", "ProductName": "communecter", "InternalName": "communecter.exe" } - } + } } diff --git a/.meteor/packages b/.meteor/packages index fa8f26c..610aa3f 100644 --- a/.meteor/packages +++ b/.meteor/packages @@ -92,3 +92,5 @@ comerc:autoform-selectize natestrauser:publish-performant-counts mizzao:user-status underscore@1.0.10 +omega:meteor-desktop-watcher@=2.0.0 +omega:meteor-desktop-bundler@=2.0.0 diff --git a/.meteor/versions b/.meteor/versions index be080e0..c9f317e 100644 --- a/.meteor/versions +++ b/.meteor/versions @@ -108,6 +108,8 @@ multiply:iron-router-progress@1.0.2 natestrauser:publish-performant-counts@0.1.2 npm-mongo@3.1.2-beta181.17 observe-sequence@1.0.16 +omega:meteor-desktop-bundler@2.0.0 +omega:meteor-desktop-watcher@2.0.0 ordered-dict@1.1.0 outatime:geolib@2.0.15 promise@0.11.2 diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json index 7cbbe99..6c93969 100644 --- a/i18n/en.i18n.json +++ b/i18n/en.i18n.json @@ -57,6 +57,7 @@ "Name is Too short":"Name is Too short", "Password is Too short":"Password is Too short", "Not the same password":"Not the same password", + "The-username-is-incorrect": "The username is incorrect: Only the characters A-Z, a-z, 0-9 and '-' are accepted.", "are you sure you want to delete":"Are you sure you want to delete ?", "Current":"Current", "Upcoming":"Upcoming", diff --git a/i18n/fr.i18n.json b/i18n/fr.i18n.json index 557d624..790bcfc 100644 --- a/i18n/fr.i18n.json +++ b/i18n/fr.i18n.json @@ -57,6 +57,7 @@ "Name is Too short":"Votre nom est trop court", "Password is Too short":"Votre mot de passe est trop court", "Not the same password":"Vous n'avez pas saisis le même mot de passe", + "The-username-is-incorrect": "Le nom d'utilisateur est incorrect : Seul les caractères A-Z, a-z, 0-9 et '-' sont acceptés.", "are you sure you want to delete":"Etes-vous sûr que vous voulez supprimer ?", "Current":"En cours", "Upcoming":"A venir", diff --git a/imports/api/citoyens.js b/imports/api/citoyens.js index 1ef9a8a..89b10be 100644 --- a/imports/api/citoyens.js +++ b/imports/api/citoyens.js @@ -25,7 +25,7 @@ export const Citoyens = new Mongo.Collection('citoyens', { idGeneration: 'MONGO' const baseSchemaCitoyens = baseSchema.pick(['name', 'shortDescription', 'description', 'url', 'tags', 'tags.$']); const updateSchemaCitoyens = new SimpleSchema({ - username: { + /* username: { type: String, custom () { if (Meteor.isClient && this.isSet) { @@ -37,7 +37,7 @@ const updateSchemaCitoyens = new SimpleSchema({ }); } }, - }, + }, */ email: { type: String, unique: true, @@ -102,21 +102,7 @@ export const SchemasCitoyensRest = new SimpleSchema([baseSchemaCitoyens, updateS export const BlockCitoyensRest = {}; BlockCitoyensRest.descriptions = new SimpleSchema([blockBaseSchema, baseSchema.pick(['shortDescription', 'description', 'tags', 'tags.$'])]); -BlockCitoyensRest.info = new SimpleSchema([blockBaseSchema, baseSchema.pick(['name', 'url']), updateSchemaCitoyens.pick(['email', 'fixe', 'mobile', 'fax', 'birthDate']), { - username: { - type: String, - custom () { - if (Meteor.isClient && this.isSet) { - Meteor.call('checkUsername', this.value, function (error, result) { - // console.log(result); - if (!result) { - BlockCitoyensRest.info.namedContext('editBlockCitoyen').addInvalidKeys([{ name: 'username', type: 'usernameNotUnique' }]); - } - }); - } - }, - }, -}]); +BlockCitoyensRest.info = new SimpleSchema([blockBaseSchema, baseSchema.pick(['name', 'url']), updateSchemaCitoyens.pick(['email', 'fixe', 'mobile', 'fax', 'birthDate'])]); BlockCitoyensRest.network = new SimpleSchema([blockBaseSchema, updateSchemaCitoyens.pick(['github', 'telegram', 'skype', 'gpplus', 'twitter', 'facebook'])]); BlockCitoyensRest.locality = new SimpleSchema([blockBaseSchema, geoSchema]); BlockCitoyensRest.preferences = new SimpleSchema([blockBaseSchema, { diff --git a/imports/api/server/method.js b/imports/api/server/method.js index d08bf00..128e1bf 100644 --- a/imports/api/server/method.js +++ b/imports/api/server/method.js @@ -1747,6 +1747,11 @@ indexMax:20 */ throw new Meteor.Error('Username not unique'); } + const urlRegEx = new RegExp(/^[a-z0-9-]+$/, 'i'); + if (urlRegEx.test(user.username) !== true) { + throw new Meteor.Error('The-username-is-incorrect'); + } + const insee = Cities.findOne({ insee: user.city }); console.log({ diff --git a/imports/startup/client/client.js b/imports/startup/client/client.js index 56633f4..32ae54f 100644 --- a/imports/startup/client/client.js +++ b/imports/startup/client/client.js @@ -69,7 +69,7 @@ Meteor.startup(function () { const m = regex.exec(intent); // alert(`${Meteor.settings.public.endpoint}${m[0]}`); if (m && m[0] && m[1] && m[2]) { - //${Meteor.settings.public.endpoint} + // ${Meteor.settings.public.endpoint} Meteor.call('validateEmail', `${Meteor.settings.public.endpoint}${m[0]}`, (error, result) => { if (error) { // alert(`${error}`); @@ -203,6 +203,14 @@ Meteor.startup(function () { }, ); + Template.registerHelper('calculateAge', (birth) => { + const bday = moment(birth, 'YYYYMMDD HH:mm'); + const today = moment().startOf('day').hour(12); + let age = today.year() - bday.year(); + if (bday > today.subtract(age, 'years')) { age -= 1; } + return age; + }); + Template.registerHelper('i18npref', (prefix, text) => TAPi18n.__(`${prefix}.${text}`)); @@ -287,24 +295,24 @@ Meteor.startup(function () { return count >= 0; } }); - + Template.registerHelper('markdown', new Blaze.Template('markdown', function () { - const view = this; - let content = ''; + const view = this; + let content = ''; + + if (view.templateContentBlock) { + content = Blaze._toText(view.templateContentBlock, HTML.TEXTMODE.STRING); + // content = view.templateContentBlock; + } + const md = new MarkdownIt('default', { + html: true, + linkify: true, + typographer: true, + }); - if (view.templateContentBlock) { - content = Blaze._toText(view.templateContentBlock, HTML.TEXTMODE.STRING); - //content = view.templateContentBlock; - } - const md = new MarkdownIt('default',{ - html: true, - linkify: true, - typographer: true - }); - const result = md.render(content); - return HTML.Raw(result); - })); + return HTML.Raw(result); + })); Template.registerHelper('SchemasFollowRest', SchemasFollowRest); Template.registerHelper('SchemasInviteAttendeesEventRest', SchemasInviteAttendeesEventRest); diff --git a/imports/startup/client/routes.js b/imports/startup/client/routes.js index a805213..a7b4099 100644 --- a/imports/startup/client/routes.js +++ b/imports/startup/client/routes.js @@ -37,9 +37,10 @@ Router.map(function() { this.route('detailListHome', { before () { - if (Meteor.loggingIn() && Meteor.user()) { + if (Meteor.userId()) { this.redirect('actusList', { scope: 'citoyens', _id: Meteor.userId() }); } + this.next(); }, template: 'dashboard', path: '/', diff --git a/imports/ui/citoyens/list.html b/imports/ui/citoyens/list.html index 8d53ddd..503a146 100644 --- a/imports/ui/citoyens/list.html +++ b/imports/ui/citoyens/list.html @@ -169,7 +169,6 @@

{{_ "citoyens"}}