2023-06-11 12:30:08 -05:00
|
|
|
import { SysConfig } from '../../../imports/api/systemConfig.js';
|
2025-06-21 07:28:59 -05:00
|
|
|
import { FlowRouter } from 'meteor/ostrio:flow-router-extra';
|
2022-08-04 19:50:18 -05:00
|
|
|
|
2023-06-11 12:30:08 -05:00
|
|
|
Template.login.onCreated(function() {
|
|
|
|
|
this.subscribe("SystemConfig");
|
2022-08-04 19:50:18 -05:00
|
|
|
});
|
|
|
|
|
|
2022-08-05 16:55:56 -05:00
|
|
|
Template.login.onRendered(function() {
|
2022-08-04 19:50:18 -05:00
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
2022-08-05 16:55:56 -05:00
|
|
|
Template.login.helpers({
|
2022-08-04 19:50:18 -05:00
|
|
|
areFilled: function() {
|
|
|
|
|
return Session.get("filledFields");
|
2023-06-11 12:30:08 -05:00
|
|
|
},
|
|
|
|
|
canReg: function() {
|
|
|
|
|
let conf = SysConfig.findOne();
|
|
|
|
|
if (typeof conf != 'undefined') {
|
|
|
|
|
return conf.allowReg;
|
|
|
|
|
} else {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2022-08-05 16:55:56 -05:00
|
|
|
}
|
2022-08-04 19:50:18 -05:00
|
|
|
});
|
|
|
|
|
|
2022-08-05 16:55:56 -05:00
|
|
|
Template.login.events({
|
2022-08-04 19:50:18 -05:00
|
|
|
'click #logmein' (event) {
|
|
|
|
|
event.preventDefault();
|
2025-07-23 19:44:24 -05:00
|
|
|
// console.log("clicked login");
|
2022-08-04 19:50:18 -05:00
|
|
|
let email = $("#email").val();
|
|
|
|
|
let pass = $("#password").val();
|
|
|
|
|
|
|
|
|
|
if (email == null || email == "" || pass == "" || pass == null) {
|
|
|
|
|
Session.set("filledFields", false);
|
|
|
|
|
return;
|
|
|
|
|
} else {
|
|
|
|
|
Meteor.loginWithPassword(email, pass);
|
|
|
|
|
}
|
|
|
|
|
},
|
2022-08-05 16:55:56 -05:00
|
|
|
'click #reg' (event) {
|
2022-08-04 19:50:18 -05:00
|
|
|
event.preventDefault();
|
2022-08-05 16:55:56 -05:00
|
|
|
FlowRouter.go('/reg');
|
2022-08-04 19:50:18 -05:00
|
|
|
},
|
|
|
|
|
});
|