2024-07-23 08:35:04 -05:00
|
|
|
import { M } from '../../lib/assets/materialize.js';
|
|
|
|
|
|
2023-06-09 13:38:10 -05:00
|
|
|
Template.userInfoModal.onCreated(function() {
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Template.userInfoModal.onRendered(function() {
|
|
|
|
|
Session.set("passMatch", true);
|
|
|
|
|
Session.set("passErr", false);
|
2024-07-23 08:35:04 -05:00
|
|
|
var elems = document.querySelectorAll('.modal');
|
|
|
|
|
var instances = M.Modal.init(elems, {});
|
2023-06-09 13:38:10 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Template.userInfoModal.helpers({
|
|
|
|
|
passMatch: function() {
|
|
|
|
|
return Session.get("passMatch");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Template.userInfoModal.events({
|
|
|
|
|
"click #chPass" (event) {
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
let usersId = Session.get("usersId");
|
|
|
|
|
let passwd = $("#newPass").val();
|
|
|
|
|
let passMatch = Session.get("passMatch");
|
|
|
|
|
if (passwd == null || passwd == "" || passMatch == false) {
|
|
|
|
|
Session.set("passErr", true);
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
Meteor.call('change.userPass', usersId, passwd, function(err, result) {
|
|
|
|
|
if (err) {
|
|
|
|
|
console.log(" ERROR changing user passwrod:" + err);
|
|
|
|
|
} else {
|
|
|
|
|
console.log(" Password changed successfully!");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
"click #closePass" (event) {;
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
"keyup #newPassConf" (event) {
|
|
|
|
|
let newPass = $("#newPass").val();
|
|
|
|
|
let newPassConf = $("#newPassConf").val();
|
|
|
|
|
if (newPassConf.length > 2 && (newPass != null || newPass != "")) {
|
|
|
|
|
if (newPass != newPassConf) {
|
|
|
|
|
Session.set("passMatch", false);
|
|
|
|
|
} else {
|
|
|
|
|
Session.set("passMatch", true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|