Repository: incubator-ignite Updated Branches: refs/heads/ignite-843 78df3dd80 -> 1ecc6d61b
# IGNITE-843 Smtp settings. Agent build fix. Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/1ecc6d61 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/1ecc6d61 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/1ecc6d61 Branch: refs/heads/ignite-843 Commit: 1ecc6d61b7638d160bd338357b773a33c91a0874 Parents: 78df3dd Author: Andrey <anovi...@gridgain.com> Authored: Mon Aug 17 13:25:01 2015 +0700 Committer: Andrey <anovi...@gridgain.com> Committed: Mon Aug 17 13:25:01 2015 +0700 ---------------------------------------------------------------------- assembly/release-schema-import.xml | 2 +- modules/control-center-agent/README.txt | 2 +- .../assembly/release-control-center-agent.xml | 64 ++++++++++++++++++++ .../bin/ignite-control-center-agent.bat | 18 ++++++ .../bin/ignite-control-center-agent.sh | 19 ++++++ modules/control-center-agent/pom.xml | 20 +++--- .../control-center-agent/src/assembly/build.xml | 34 ----------- modules/control-center-agent/src/bin/agent.bat | 18 ------ modules/control-center-agent/src/bin/agent.sh | 19 ------ .../src/main/js/config/default.json | 5 ++ .../src/main/js/routes/public.js | 32 ++++++---- 11 files changed, 138 insertions(+), 95 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1ecc6d61/assembly/release-schema-import.xml ---------------------------------------------------------------------- diff --git a/assembly/release-schema-import.xml b/assembly/release-schema-import.xml index b746c83..38457b9 100644 --- a/assembly/release-schema-import.xml +++ b/assembly/release-schema-import.xml @@ -21,7 +21,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> - <id>scala</id> + <id>release-schema-import</id> <includeBaseDirectory>false</includeBaseDirectory> http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1ecc6d61/modules/control-center-agent/README.txt ---------------------------------------------------------------------- diff --git a/modules/control-center-agent/README.txt b/modules/control-center-agent/README.txt index 3712cbd..694fa89 100644 --- a/modules/control-center-agent/README.txt +++ b/modules/control-center-agent/README.txt @@ -11,7 +11,7 @@ Two main functions of Ignite Control Center Agent: You may need to copy JDBC driver into "./jdbc-drivers" subfolder or specify path via "-drv" option. Usage example: - agent.sh -l john.sm...@gmail.com -p qwerty -s wss://control-center.example.com + ignite-control-center-agent.sh -l john.sm...@gmail.com -p qwerty -s wss://control-center.example.com Configuration file: Should be a file with simple line-oriented format as described here: http://docs.oracle.com/javase/7/docs/api/java/util/Properties.html#load(java.io.Reader) http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1ecc6d61/modules/control-center-agent/assembly/release-control-center-agent.xml ---------------------------------------------------------------------- diff --git a/modules/control-center-agent/assembly/release-control-center-agent.xml b/modules/control-center-agent/assembly/release-control-center-agent.xml new file mode 100644 index 0000000..d0a527c --- /dev/null +++ b/modules/control-center-agent/assembly/release-control-center-agent.xml @@ -0,0 +1,64 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + Licensed to the Apache Software Foundation (ASF) under one or more + contributor license agreements. See the NOTICE file distributed with + this work for additional information regarding copyright ownership. + The ASF licenses this file to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd"> + <id>dependencies-control-center-agent</id> + + <formats> + <format>zip</format> + </formats> + + <fileSets> + <fileSet> + <directory>${basedir}</directory> + <outputDirectory>/</outputDirectory> + <includes> + <include>jdbc-drivers/README*</include> + <include>README*</include> + <include>LICENSE*</include> + <include>NOTICE*</include> + </includes> + </fileSet> + <fileSet> + <directory>${basedir}/bin</directory> + <outputDirectory>/</outputDirectory> + <includes> + <include>**/*.bat</include> + <include>**/*.exe</include> + </includes> + </fileSet> + <fileSet> + <directory>${basedir}/bin</directory> + <outputDirectory>/</outputDirectory> + <fileMode>0755</fileMode> + <includes> + <include>**/*.sh</include> + </includes> + </fileSet> + <fileSet> + <directory>${project.build.directory}</directory> + <outputDirectory>/</outputDirectory> + <includes> + <include>agent-${project.version}.jar</include> + </includes> + </fileSet> + </fileSets> +</assembly> http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1ecc6d61/modules/control-center-agent/bin/ignite-control-center-agent.bat ---------------------------------------------------------------------- diff --git a/modules/control-center-agent/bin/ignite-control-center-agent.bat b/modules/control-center-agent/bin/ignite-control-center-agent.bat new file mode 100755 index 0000000..74b8299 --- /dev/null +++ b/modules/control-center-agent/bin/ignite-control-center-agent.bat @@ -0,0 +1,18 @@ +:: +:: Licensed to the Apache Software Foundation (ASF) under one or more +:: contributor license agreements. See the NOTICE file distributed with +:: this work for additional information regarding copyright ownership. +:: The ASF licenses this file to You under the Apache License, Version 2.0 +:: (the "License"); you may not use this file except in compliance with +:: the License. You may obtain a copy of the License at +:: +:: http://www.apache.org/licenses/LICENSE-2.0 +:: +:: Unless required by applicable law or agreed to in writing, software +:: distributed under the License is distributed on an "AS IS" BASIS, +:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +:: See the License for the specific language governing permissions and +:: limitations under the License. +:: + +java -jar agent-${version}.jar %* http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1ecc6d61/modules/control-center-agent/bin/ignite-control-center-agent.sh ---------------------------------------------------------------------- diff --git a/modules/control-center-agent/bin/ignite-control-center-agent.sh b/modules/control-center-agent/bin/ignite-control-center-agent.sh new file mode 100755 index 0000000..1e03cff --- /dev/null +++ b/modules/control-center-agent/bin/ignite-control-center-agent.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +java -jar agent-${version}.jar "$@" \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1ecc6d61/modules/control-center-agent/pom.xml ---------------------------------------------------------------------- diff --git a/modules/control-center-agent/pom.xml b/modules/control-center-agent/pom.xml index 63f0dcd..c832a7f 100644 --- a/modules/control-center-agent/pom.xml +++ b/modules/control-center-agent/pom.xml @@ -99,30 +99,32 @@ </goals> <configuration> - + <createDependencyReducedPom>false</createDependencyReducedPom> </configuration> </execution> </executions> </plugin> <plugin> + <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <version>2.4</version> - <configuration> - <descriptors> - <descriptor>src/assembly/build.xml</descriptor> - </descriptors> - - <appendAssemblyId>false</appendAssemblyId> - </configuration> + <inherited>false</inherited> <executions> <execution> - <id>make-assembly</id> + <id>release-control-center-agent</id> <phase>package</phase> <goals> <goal>single</goal> </goals> + <configuration> + <descriptors> + <descriptor>assembly/release-control-center-agent.xml</descriptor> + </descriptors> + <outputDirectory>target</outputDirectory> + <appendAssemblyId>false</appendAssemblyId> + </configuration> </execution> </executions> </plugin> http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1ecc6d61/modules/control-center-agent/src/assembly/build.xml ---------------------------------------------------------------------- diff --git a/modules/control-center-agent/src/assembly/build.xml b/modules/control-center-agent/src/assembly/build.xml deleted file mode 100644 index 83b071b..0000000 --- a/modules/control-center-agent/src/assembly/build.xml +++ /dev/null @@ -1,34 +0,0 @@ -<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd"> - <id>agent</id> - - <formats> - <format>zip</format> - </formats> - - <fileSets> - <fileSet> - <directory>${project.basedir}</directory> - <outputDirectory>/</outputDirectory> - <includes> - <include>jdbc-drivers/README*</include> - <include>README*</include> - <include>LICENSE*</include> - <include>NOTICE*</include> - </includes> - </fileSet> - <fileSet> - <directory>${project.basedir}/src/bin</directory> - <outputDirectory>/</outputDirectory> - <filtered>true</filtered> - </fileSet> - <fileSet> - <directory>${project.build.directory}</directory> - <outputDirectory>/</outputDirectory> - <includes> - <include>agent-${project.version}.jar</include> - </includes> - </fileSet> - </fileSets> -</assembly> http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1ecc6d61/modules/control-center-agent/src/bin/agent.bat ---------------------------------------------------------------------- diff --git a/modules/control-center-agent/src/bin/agent.bat b/modules/control-center-agent/src/bin/agent.bat deleted file mode 100755 index 74b8299..0000000 --- a/modules/control-center-agent/src/bin/agent.bat +++ /dev/null @@ -1,18 +0,0 @@ -:: -:: Licensed to the Apache Software Foundation (ASF) under one or more -:: contributor license agreements. See the NOTICE file distributed with -:: this work for additional information regarding copyright ownership. -:: The ASF licenses this file to You under the Apache License, Version 2.0 -:: (the "License"); you may not use this file except in compliance with -:: the License. You may obtain a copy of the License at -:: -:: http://www.apache.org/licenses/LICENSE-2.0 -:: -:: Unless required by applicable law or agreed to in writing, software -:: distributed under the License is distributed on an "AS IS" BASIS, -:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -:: See the License for the specific language governing permissions and -:: limitations under the License. -:: - -java -jar agent-${version}.jar %* http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1ecc6d61/modules/control-center-agent/src/bin/agent.sh ---------------------------------------------------------------------- diff --git a/modules/control-center-agent/src/bin/agent.sh b/modules/control-center-agent/src/bin/agent.sh deleted file mode 100755 index 1e03cff..0000000 --- a/modules/control-center-agent/src/bin/agent.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -java -jar agent-${version}.jar "$@" \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1ecc6d61/modules/control-center-web/src/main/js/config/default.json ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/config/default.json b/modules/control-center-web/src/main/js/config/default.json index f7f7a02..19e1fba 100644 --- a/modules/control-center-web/src/main/js/config/default.json +++ b/modules/control-center-web/src/main/js/config/default.json @@ -13,5 +13,10 @@ "cert": "keys/test.crt", "keyPassphrase": "password" } + }, + "smtp": { + "service": "", + "username": "", + "password": "" } } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/1ecc6d61/modules/control-center-web/src/main/js/routes/public.js ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/routes/public.js b/modules/control-center-web/src/main/js/routes/public.js index 96f30a9..dcc5f71 100644 --- a/modules/control-center-web/src/main/js/routes/public.js +++ b/modules/control-center-web/src/main/js/routes/public.js @@ -19,7 +19,9 @@ var router = require('express').Router(); var passport = require('passport'); var crypto = require('crypto'); var nodemailer = require('nodemailer'); + var db = require('../db'); +var config = require('../helpers/configuration-loader.js'); // GET dropdown-menu template. router.get('/select', function (req, res) { @@ -109,12 +111,22 @@ router.get('/logout', function (req, res) { res.redirect('/'); }); -var _mailUser = '!!! YOUR USERNAME !!!'; -var _mailPass = '!!! YOUR PASSWORD !!!'; - /** - * Request for password reset and send e-mail to user with reset token. */ + * Request for password reset and send e-mail to user with reset token. + */ router.post('/request_password_reset', function(req, res) { + var transporter = { + service: config.get('smtp:service'), + auth: { + user:config.get('smtp:username'), + pass: config.get('smtp:password') + } + }; + + if (transporter.service == '' || transporter.auth.user == '' || transporter.auth.pass == '') + return res.status(401).send('Can\'t send e-mail with instructions to reset password.<br />' + + 'Please ask webmaster to setup smtp server!'); + var token = crypto.randomBytes(20).toString('hex'); db.Account.findOne({ email: req.body.email }, function(err, user) { @@ -130,16 +142,10 @@ router.post('/request_password_reset', function(req, res) { if (err) return res.status(401).send(err); - var transporter = nodemailer.createTransport({ - service: 'gmail', - auth: { - user: _mailUser, - pass: _mailPass - } - }); + var mailer = nodemailer.createTransport(transporter); var mailOptions = { - from: _mailUser, + from: transporter.auth.user, to: user.email, subject: 'Password Reset', text: 'You are receiving this because you (or someone else) have requested the reset of the password for your account.\n\n' + @@ -150,7 +156,7 @@ router.post('/request_password_reset', function(req, res) { 'Apache Ignite Web Control Center\n' }; - transporter.sendMail(mailOptions, function(err){ + mailer.sendMail(mailOptions, function(err){ if (err) return res.status(401).send('Failed to send e-mail with reset link!<br />' + err);