get_my/client/Accounts/Login/login.js

44 lines
1.1 KiB
JavaScript
Raw Normal View History

import { SysConfig } from '../../../imports/api/systemConfig.js';
import { FlowRouter } from 'meteor/ostrio:flow-router-extra';
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();
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);
}
},
'click #reg' (event) {
2022-08-04 19:50:18 -05:00
event.preventDefault();
FlowRouter.go('/reg');
2022-08-04 19:50:18 -05:00
},
});