diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json index e70ed2ba3b4..b38261d54de 100644 --- a/i18n/en.i18n.json +++ b/i18n/en.i18n.json @@ -340,6 +340,7 @@ "Password_changed_successfully" : "Password changed successfully", "People" : "People", "Please_enter_value_for_url" : "Please enter a value for the url of your avatar.", + "Please_enter_your_new_password_below" : "Please enter your new password below:", "Please_wait" : "Please wait", "Please_wait_activation" : "Please wait, this can take some time.", "Please_wait_statistics" : "Please wait, statistics are being generated.", @@ -383,6 +384,7 @@ "Remove_Admin" : "Remove Admin", "Remove_custom_oauth" : "Remove custom oauth", "Remove_from_room" : "Remove from room", + "Reset" : "Reset", "Reset_password" : "Reset password", "Restart" : "Restart", "Restart_the_server" : "Restart the server", @@ -484,6 +486,7 @@ "There_is_no_integrations" : "There is no integrations", "This_is_a_push_test_messsage" : "This is a push test messsage", "True" : "True", + "Type_your_new_password" : "Type your new password", "Unarchive" : "Unarchive", "Unmute_user" : "Unmute user", "Unnamed" : "Unnamed", diff --git a/packages/rocketchat-cors/cors.coffee b/packages/rocketchat-cors/cors.coffee index ea47d21760e..971777d4952 100644 --- a/packages/rocketchat-cors/cors.coffee +++ b/packages/rocketchat-cors/cors.coffee @@ -1,5 +1,28 @@ # Adding CORS headers so we can use CDNs for static content +# Try to parse all request bodies as JSON +WebApp.rawConnectHandlers.use (req, res, next) -> + if req._body + return next() + + if req.headers['transfer-encoding'] is undefined and isNaN(req.headers['content-length']) + return next() + + buf = '' + req.setEncoding('utf8') + req.on 'data', (chunk) -> buf += chunk + req.on 'end', -> + if RocketChat?.debugLevel? and RocketChat.debugLevel is 'debug' + console.log '[request]'.green, req.method, req.url, '\nheaders ->', req.headers, '\nbody ->', buf + + try + req.body = JSON.parse(buf) + catch err + req.body = buf + + next() + + WebApp.rawConnectHandlers.use (req, res, next) -> res.setHeader("Access-Control-Allow-Origin", "*") res.setHeader("X-Rocket-Chat-Version", VERSION) diff --git a/packages/rocketchat-integrations/server/api/api.coffee b/packages/rocketchat-integrations/server/api/api.coffee index a7321099b93..508b3c7e77f 100644 --- a/packages/rocketchat-integrations/server/api/api.coffee +++ b/packages/rocketchat-integrations/server/api/api.coffee @@ -73,7 +73,7 @@ Api.addRoute ':integrationId/:userId/:token', authRequired: true, message = alias: @bodyParams.username or @bodyParams.alias or integration.alias - msg: @bodyParams.text or @bodyParams.msg or '' + msg: _.trim(@bodyParams.text or @bodyParams.msg or '') attachments: @bodyParams.attachments parseUrls: false bot: @@ -92,7 +92,7 @@ Api.addRoute ':integrationId/:userId/:token', authRequired: true, if _.isArray message.attachments for attachment in message.attachments if attachment.msg - attachment.text = attachment.msg + attachment.text = _.trim(attachment.msg) delete attachment.msg RocketChat.sendMessage user, message, room, {} diff --git a/packages/rocketchat-lib/package.js b/packages/rocketchat-lib/package.js index 78f6a244835..f2d0eb226c9 100644 --- a/packages/rocketchat-lib/package.js +++ b/packages/rocketchat-lib/package.js @@ -25,11 +25,12 @@ Package.onUse(function(api) { api.use('rocketchat:version'); api.use('kadira:flow-router', 'client'); + api.addFiles('lib/core.coffee'); + // DEBUGGER api.addFiles('server/lib/debug.js', 'server'); // COMMON LIB - api.addFiles('lib/core.coffee'); api.addFiles('lib/settings.coffee'); api.addFiles('lib/callbacks.coffee'); api.addFiles('lib/slashCommand.coffee'); diff --git a/packages/rocketchat-lib/server/lib/debug.js b/packages/rocketchat-lib/server/lib/debug.js index 243928778ac..c63fc96bf72 100644 --- a/packages/rocketchat-lib/server/lib/debug.js +++ b/packages/rocketchat-lib/server/lib/debug.js @@ -1,21 +1,21 @@ -var debugLevel = 'debug'; +RocketChat.debugLevel = 'debug'; Meteor.startup(function() { RocketChat.settings.onload('Debug_Level', function(key, value, initialLoad) { if (value) { - debugLevel = value; + RocketChat.debugLevel = value; } }); var value = RocketChat.settings.get('Debug_Level'); if (value) { - debugLevel = value; + RocketChat.debugLevel = value; } }); var wrapMethods = function(name, originalHandler, methodsMap) { methodsMap[name] = function() { - if (debugLevel === 'debug') { + if (RocketChat.debugLevel === 'debug') { console.log('[methods]'.green, name, '-> userId:', Meteor.userId(), ', arguments: ', arguments); } @@ -36,7 +36,7 @@ var originalMeteorPublish = Meteor.publish; Meteor.publish = function(name, func) { return originalMeteorPublish(name, function() { - if (debugLevel === 'debug') { + if (RocketChat.debugLevel === 'debug') { console.log('[publish]'.green, name, '-> userId:', this.userId, ', arguments: ', arguments); } diff --git a/packages/rocketchat-livechat/server/methods/registerGuest.js b/packages/rocketchat-livechat/server/methods/registerGuest.js index 8131aa6aa8e..1187eae6ef3 100644 --- a/packages/rocketchat-livechat/server/methods/registerGuest.js +++ b/packages/rocketchat-livechat/server/methods/registerGuest.js @@ -35,7 +35,7 @@ Meteor.methods({ } userData = { username: user, - globalRoles: 'livechat-guest', + globalRoles: ['livechat-guest'], department: department }; userId = Accounts.insertUserDoc({}, userData); diff --git a/packages/rocketchat-message-attachments/client/messageAttachment.coffee b/packages/rocketchat-message-attachments/client/messageAttachment.coffee index 5cf3138934c..4bfee816da8 100644 --- a/packages/rocketchat-message-attachments/client/messageAttachment.coffee +++ b/packages/rocketchat-message-attachments/client/messageAttachment.coffee @@ -21,3 +21,10 @@ Template.messageAttachment.helpers getImageHeight: (height) -> return height or 200 + + color: -> + switch @color + when 'good' then return '#35AC19' + when 'warning' then return '#FCB316' + when 'danger' then return '#D30230' + else return @color diff --git a/packages/rocketchat-theme/server/variables.coffee b/packages/rocketchat-theme/server/variables.coffee index ce01a462e00..3a0557a4e66 100755 --- a/packages/rocketchat-theme/server/variables.coffee +++ b/packages/rocketchat-theme/server/variables.coffee @@ -1,30 +1,30 @@ -RocketChat.theme.addPublicColor "primary-background-color", "#04436A" +RocketChat.theme.addPublicColor "primary-background-color", "#04436a" RocketChat.theme.addPublicColor "primary-font-color", "#444444" -RocketChat.theme.addPublicColor "secondary-background-color", "#F4F4F4" -RocketChat.theme.addPublicColor "secondary-font-color", "#7F7F7F" -RocketChat.theme.addPublicColor "tertiary-background-color", "#EAEAEA" +RocketChat.theme.addPublicColor "secondary-background-color", "#f4f4f4" +RocketChat.theme.addPublicColor "secondary-font-color", "#7f7f7f" +RocketChat.theme.addPublicColor "tertiary-background-color", "#eaeaea" RocketChat.theme.addPublicColor "tertiary-font-color", "rgba(255, 255, 255, 0.6)" -RocketChat.theme.addPublicColor "quaternary-font-color", "#FFF" +RocketChat.theme.addPublicColor "quaternary-font-color", "#ffffff" RocketChat.theme.addPublicColor "action-buttons-color", "#13679a" RocketChat.theme.addPublicColor "active-channel-background-color", "rgba(255, 255, 255, 0.075)" RocketChat.theme.addPublicColor "active-channel-font-color", "rgba(255, 255, 255, 0.75)" -RocketChat.theme.addPublicColor "blockquote-background", "#CCC" -RocketChat.theme.addPublicColor "clean-buttons-color", "rgba(0, 0, 0, 0.025)" -RocketChat.theme.addPublicColor "code-background", "#F8F8F8" -RocketChat.theme.addPublicColor "code-border", "#CCC" -RocketChat.theme.addPublicColor "code-color", "#333" -RocketChat.theme.addPublicColor "content-background-color", "#FFF" +RocketChat.theme.addPublicColor "blockquote-background", "#cccccc" +RocketChat.theme.addPublicColor "clean-buttons-color", "rgba(0, 0, 0, 0.25)" +RocketChat.theme.addPublicColor "code-background", "#f8f8f8" +RocketChat.theme.addPublicColor "code-border", "#cccccc" +RocketChat.theme.addPublicColor "code-color", "#333333" +RocketChat.theme.addPublicColor "content-background-color", "#ffffff" RocketChat.theme.addPublicColor "custom-scrollbar-color", "rgba(255, 255, 255, 0.05)" -RocketChat.theme.addPublicColor "info-active-font-color", "#FF0000" -RocketChat.theme.addPublicColor "info-font-color", "#AAAAAA" +RocketChat.theme.addPublicColor "info-active-font-color", "#ff0000" +RocketChat.theme.addPublicColor "info-font-color", "#aaaaaa" RocketChat.theme.addPublicColor "input-font-color", "rgba(255, 255, 255, 0.85)" -RocketChat.theme.addPublicColor "link-font-color", "#008CE3" +RocketChat.theme.addPublicColor "link-font-color", "#008ce3" RocketChat.theme.addPublicColor "message-hover-background-color", "#f9f9f9" -RocketChat.theme.addPublicColor "smallprint-font-color", "#C2E7FF" -RocketChat.theme.addPublicColor "smallprint-hover-color", "#FFFFFF" -RocketChat.theme.addPublicColor "status-away", "#FCB316" -RocketChat.theme.addPublicColor "status-busy", "#D30230" +RocketChat.theme.addPublicColor "smallprint-font-color", "#c2e7ff" +RocketChat.theme.addPublicColor "smallprint-hover-color", "#ffffff" +RocketChat.theme.addPublicColor "status-away", "#fcb316" +RocketChat.theme.addPublicColor "status-busy", "#d30230" RocketChat.theme.addPublicColor "status-offline", "rgba(150, 150, 150, 0.50)" -RocketChat.theme.addPublicColor "status-online", "#35AC19" +RocketChat.theme.addPublicColor "status-online", "#35ac19" RocketChat.theme.addPublicColor "unread-notification-color", "#1dce73" diff --git a/packages/rocketchat-ui-admin/admin/admin.coffee b/packages/rocketchat-ui-admin/admin/admin.coffee index 9658968c918..8c3105542a4 100644 --- a/packages/rocketchat-ui-admin/admin/admin.coffee +++ b/packages/rocketchat-ui-admin/admin/admin.coffee @@ -224,10 +224,10 @@ Template.admin.onRendered -> Meteor.setTimeout -> $('input.minicolors').minicolors({theme: 'rocketchat'}) - , 500 + , 1000 Tracker.autorun -> FlowRouter.watchPathChange() Meteor.setTimeout -> $('input.minicolors').minicolors({theme: 'rocketchat'}) - , 200 + , 400 diff --git a/packages/rocketchat-ui-login/login/layout.html b/packages/rocketchat-ui-login/login/layout.html index 3cf9cd1bb29..a097d5834bb 100644 --- a/packages/rocketchat-ui-login/login/layout.html +++ b/packages/rocketchat-ui-login/login/layout.html @@ -2,7 +2,7 @@
{{ > loginHeader }} - {{ > loginForm }} + {{> Template.dynamic template=center}} {{ > loginFooter }}
diff --git a/packages/rocketchat-ui-login/package.js b/packages/rocketchat-ui-login/package.js index 5b2c11042cb..f2f5a02e8c0 100644 --- a/packages/rocketchat-ui-login/package.js +++ b/packages/rocketchat-ui-login/package.js @@ -20,6 +20,13 @@ Package.onUse(function(api) { 'rocketchat:lib@0.0.1' ]); + api.use('kadira:flow-router', 'client'); + + api.addFiles('routes.js', 'client'); + + api.addFiles('reset-password/resetPassword.html', 'client'); + api.addFiles('reset-password/resetPassword.js', 'client'); + api.addFiles('login/footer.html', 'client'); api.addFiles('login/form.html', 'client'); api.addFiles('login/header.html', 'client'); @@ -37,4 +44,4 @@ Package.onUse(function(api) { api.addFiles('login/services.coffee', 'client'); api.addFiles('login/social.coffee', 'client'); api.addFiles('username/username.coffee', 'client'); -}); \ No newline at end of file +}); diff --git a/packages/rocketchat-ui-login/reset-password/resetPassword.html b/packages/rocketchat-ui-login/reset-password/resetPassword.html new file mode 100644 index 00000000000..56d24686730 --- /dev/null +++ b/packages/rocketchat-ui-login/reset-password/resetPassword.html @@ -0,0 +1,15 @@ + diff --git a/packages/rocketchat-ui-login/reset-password/resetPassword.js b/packages/rocketchat-ui-login/reset-password/resetPassword.js new file mode 100644 index 00000000000..ae91df07180 --- /dev/null +++ b/packages/rocketchat-ui-login/reset-password/resetPassword.js @@ -0,0 +1,26 @@ +Template.resetPassword.events({ + 'submit #login-card': function(event, instance) { + event.preventDefault(); + + var button = instance.$('button.resetpass'); + RocketChat.Button.loading(button); + + Accounts.resetPassword(FlowRouter.getParam('token'), instance.find('[name=newPassword]').value, function(error) { + RocketChat.Button.reset(button); + if (error) { + console.log(error); + swal({ + title: t('Error_changing_password'), + type: 'error' + }); + } else { + FlowRouter.go('home'); + toastr.success(t('Password_changed_successfully')); + } + }); + } +}); + +Template.resetPassword.onRendered(function() { + this.find('[name=newPassword]').focus(); +}); diff --git a/packages/rocketchat-ui-login/routes.js b/packages/rocketchat-ui-login/routes.js new file mode 100644 index 00000000000..a6ac9f5b22f --- /dev/null +++ b/packages/rocketchat-ui-login/routes.js @@ -0,0 +1,6 @@ +FlowRouter.route('/reset-password/:token', { + name: 'resetPassword', + action: function() { + BlazeLayout.render('loginLayout', {center: 'resetPassword'}); + } +}); diff --git a/packages/rocketchat-ui-master/master/main.html b/packages/rocketchat-ui-master/master/main.html index abf74f660a8..e8229fc6d27 100644 --- a/packages/rocketchat-ui-master/master/main.html +++ b/packages/rocketchat-ui-master/master/main.html @@ -43,7 +43,7 @@