add oauth flows, profile, logout page, and index page
This commit is contained in:
parent
650c93273a
commit
b0270cc98b
31 changed files with 449 additions and 162 deletions
28
imports/startup/server/accounts/email-templates.js
Normal file
28
imports/startup/server/accounts/email-templates.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
import { Meteor } from 'meteor/meteor';
|
||||
import { Accounts } from 'meteor/accounts-base';
|
||||
|
||||
const name = 'Application Name';
|
||||
const email = '<support@application.com>';
|
||||
const from = `${name} ${email}`;
|
||||
const emailTemplates = Accounts.emailTemplates;
|
||||
|
||||
emailTemplates.siteName = name;
|
||||
emailTemplates.from = from;
|
||||
|
||||
emailTemplates.resetPassword = {
|
||||
subject() {
|
||||
return `[${name}] Reset Your Password`;
|
||||
},
|
||||
text(user, url) {
|
||||
const userEmail = user.emails[0].address;
|
||||
const urlWithoutHash = url.replace('#/', '');
|
||||
|
||||
if (Meteor.isDevelopment) console.info(`Reset Password Link: ${urlWithoutHash}`);
|
||||
|
||||
return `A password reset has been requested for the account related to this
|
||||
address (${userEmail}). To reset the password, visit the following link:
|
||||
\n\n${urlWithoutHash}\n\n If you did not request this reset, please ignore
|
||||
this email. If you feel something is wrong, please contact our support team:
|
||||
${email}.`;
|
||||
},
|
||||
};
|
||||
2
imports/startup/server/accounts/index.js
Normal file
2
imports/startup/server/accounts/index.js
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
import './oauth';
|
||||
import './email-templates';
|
||||
13
imports/startup/server/accounts/oauth.js
Normal file
13
imports/startup/server/accounts/oauth.js
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import { Meteor } from 'meteor/meteor';
|
||||
import { ServiceConfiguration } from 'meteor/service-configuration';
|
||||
|
||||
const OAuthSettings = Meteor.settings.private.OAuth;
|
||||
|
||||
if (OAuthSettings) {
|
||||
Object.keys(OAuthSettings).forEach((service) => {
|
||||
ServiceConfiguration.configurations.upsert(
|
||||
{ service },
|
||||
{ $set: OAuthSettings[service] },
|
||||
);
|
||||
});
|
||||
}
|
||||
7
imports/startup/server/accounts/on-create-user.js
Normal file
7
imports/startup/server/accounts/on-create-user.js
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
import { Accounts } from 'meteor/accounts-base';
|
||||
|
||||
Accounts.onCreateUser((options, user) => {
|
||||
const userToCreate = user;
|
||||
if (options.profile) userToCreate.profile = options.profile;
|
||||
return userToCreate;
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue