get_my/client/Accounts/Login/login.js

43 lines
1 KiB
JavaScript
Raw Normal View History

import { SysConfig } from '../../../imports/api/systemConfig.js';
2022-08-04 19:50:18 -05:00
Template.login.onCreated(function() {
this.subscribe("SystemConfig");
2022-08-04 19:50:18 -05:00
});
Template.login.onRendered(function() {
2022-08-04 19:50:18 -05:00
});
Template.login.helpers({
2022-08-04 19:50:18 -05:00
areFilled: function() {
return Session.get("filledFields");
},
canReg: function() {
let conf = SysConfig.findOne();
if (typeof conf != 'undefined') {
return conf.allowReg;
} else {
return true;
}
}
2022-08-04 19:50:18 -05:00
});
Template.login.events({
2022-08-04 19:50:18 -05:00
'click #logmein' (event) {
event.preventDefault();
console.log("clicked login");
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);
}
},
'click #reg' (event) {
2022-08-04 19:50:18 -05:00
event.preventDefault();
FlowRouter.go('/reg');
2022-08-04 19:50:18 -05:00
},
});