Hello everyone! its me, again jejeje… Please Iam very new. Sorry for I newbie
I have a two problems that cant find examples in web to solve:
- I don’t how write to continue my code.
- Why the server console, send me this message? strange is it send me a emai such I never passed demo@demo.com More of that! I made never click in button “send”
I20160718-18:18:54.375(-5)? ====== BEGIN MAIL #0 ======
I20160718-18:18:54.377(-5)? (Mail not sent; to enable sending, set the MAIL_URL environment variable.)
I20160718-18:18:54.379(-5)? MIME-Version: 1.0
I20160718-18:18:54.380(-5)? Date: Mon, 18 Jul 2016 23:18:54 +0000
I20160718-18:18:54.380(-5)? From: “Meteor Accounts” no-reply@meteor.com
I20160718-18:18:54.380(-5)? To: demo@demo.com
I20160718-18:18:54.381(-5)? Subject: How to reset your password on localhost:3000
I20160718-18:18:54.381(-5)? Content-Type: text/plain; charset=utf-8
I20160718-18:18:54.381(-5)? Content-Transfer-Encoding: quoted-printable
I20160718-18:18:54.382(-5)?
I20160718-18:18:54.383(-5)? Hello,
I20160718-18:18:54.384(-5)?
I20160718-18:18:54.384(-5)? To reset your password, simply click the link below.
I20160718-18:18:54.385(-5)?
I20160718-18:18:54.385(-5)? http://localhost:3000/#/reset-password/j8yG5Mw4toiyRkVH3B0vezD-Dr1tuYGWpBkUoL7Ghay
I20160718-18:18:54.385(-5)?
I20160718-18:18:54.385(-5)? Thanks.
I20160718-18:18:54.385(-5)?
I20160718-18:18:54.386(-5)? ====== END MAIL #0 ======
the previous message is rare because appears sudden. When I put other email valid in the input, the same message appears but with the email validated in mongo .
Other thing rare is the link works if I put in the URLs bar… I can change the passwords, but why? I dont tell the system that do it. This is the link:
http://localhost:3000/#/reset-password/j8yG5Mw4toiyRkVH3B0vezD-Dr1tuYGWpBkUoL7Ghay
This is my code.:
imports/ui/components/recuperar/recuperar.html
<form>
<input type="email" name="email" placeholder="Email Address" ng-model="recuperar.email">
<button ng-click="recuperar.send()">Send</button>
</form>
imports/api/usuarios.js
import angular from 'angular';
import angularMeteor from 'angular-meteor';
import { Accounts } from 'meteor/accounts-base';
import { Meteor } from 'meteor/meteor';
import './recuperar.html';
class Recuperar {
constructor($scope, $reactive) {
'ngInject';
$reactive(this).attach($scope);
this.email = '';
this.answer = {
show: false,
message: '',
fontawesome: ''
};
}
send(){
Accounts.forgotPassword({email:this.email}, this.$bindToContext((err) => {
this.answer.show = true;
if (err) {
this.answer.message = 'Error';
console.log('This is the error:', err);
} else {
this.answer.message = 'Success';
console.log('Success, to send email to backend, I think');
}
})
);
}
}
const name = 'recuperar';
// create a module
export default angular
.module(name, [
angularMeteor
])
.component(name, {
templateUrl: `imports/ui/components/${name}/${name}.html`,
controllerAs: name,
controller: Recuperar
})
.config(config);
function config($stateProvider) {
'ngInject';
$stateProvider
.state('inicio.recuperar', {
url: '/recuperar',
template: '<recuperar></recuperar>'
});
}
imports/api/usuarios.js
import { Meteor } from 'meteor/meteor';
import { Accounts } from 'meteor/accounts-base';
import { Djs } from '../api/djs/index';
if (Meteor.isServer) {
Meteor.publish('users', function() {
return Meteor.users.find({}, {
fields: {
emails: 1
}
});
});
Accounts.onCreateUser((options, user) => {
var dj = {};
dj._id = user._id;
dj.datas = {};
dj.perfil = 'dj';
if (user.services.facebook) {
var datos = user.services.facebook || {};
dj.datas.name = datos.first_name || '';
dj.datas.lastName = datos.last_name || '';
dj.datas.sex = datos.gender == 'male' ?
'Man' : 'Woman' || '';
dj.datas.email = datos.email || '';
} else {
dj.datas.email = user.emails[0].address || '';
}
Djs.insert(dj,
(success) => {
},
(error) => {
throw new Error('Nose puedo crear el usuario.');
});
return user;
});
Accounts.sendResetPasswordEmail(() => {
console.log('We are inside Accounts.sendResetPasswordEmail');
});
}