My code that utilises the accounts-entry package and manages authentication on routes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FixArrays = function(arrayObject) { | |
| var temp = {}; | |
| _.each(arrayObject , function(value, key, list) { | |
| if (value instanceof Array) | |
| if (value.length === 1) | |
| temp[key] = value[0]; | |
| else | |
| temp[key] = value; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (Meteor.isServer) { | |
| Meteor.startup(function () { | |
| process.env.MAIL_URL = 'smtp://username:[email protected]'; | |
| Accounts.emailTemplates.siteName = "My Website Name"; | |
| Accounts.emailTemplates.from = "My Website Name <[email protected]>"; | |
| Accounts.emailTemplates.resetPassword.subject = function(user) { | |
| return "How to reset your password for My Website Name"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Meteor.autorun(function() { | |
| if (Meteor.user()) { | |
| Meteor.logoutOtherClients(function(err) { | |
| if (err) | |
| console.log("Logout Error: " + err); | |
| }); | |
| console.log("login"); | |
| } else { | |
| console.log("logout"); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // This collection is where the UserSession variables are ultimately stored | |
| UserSessionCollection = new Meteor.Collection('userSessionCollection'); | |
| // Anonymous user error | |
| noUserError = function () { | |
| console.log('You cannot use UserSession methods when there is no user logged in.'); | |
| } | |
| // Missing userId error | |
| noUserIdError = function () { |
