mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Merge pull request #13050 from meteor/feature/fix-oauth-ui-methods
[Meteor 3] Fix OAuth methods
This commit is contained in:
@@ -716,7 +716,7 @@ export class AccountsServer extends AccountsCommon {
|
||||
|
||||
// Allow a one-time configuration for a login service. Modifications
|
||||
// to this collection are also allowed in insecure mode.
|
||||
methods.configureLoginService = (options) => {
|
||||
methods.configureLoginService = async (options) => {
|
||||
check(options, Match.ObjectIncluding({service: String}));
|
||||
// Don't let random users configure a service we haven't added yet (so
|
||||
// that when we do later add it, it's set up with their configuration
|
||||
@@ -731,7 +731,8 @@ export class AccountsServer extends AccountsCommon {
|
||||
|
||||
if (Package['service-configuration']) {
|
||||
const { ServiceConfiguration } = Package['service-configuration'];
|
||||
if (ServiceConfiguration.configurations.findOneAsync({service: options.service}))
|
||||
const service = await ServiceConfiguration.configurations.findOneAsync({service: options.service})
|
||||
if (service)
|
||||
throw new Meteor.Error(403, `Service ${options.service} already configured`);
|
||||
|
||||
if (Package["oauth-encryption"]) {
|
||||
@@ -740,7 +741,7 @@ export class AccountsServer extends AccountsCommon {
|
||||
options.secret = OAuthEncryption.seal(options.secret);
|
||||
}
|
||||
|
||||
ServiceConfiguration.configurations.insert(options);
|
||||
await ServiceConfiguration.configurations.insertAsync(options);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -90,8 +90,8 @@ Meteor.startup(() => {
|
||||
}, {
|
||||
"secret.algorithm": { $exists: false }
|
||||
}]
|
||||
}).forEach(config => {
|
||||
ServiceConfiguration.configurations.update(config._id, {
|
||||
}).forEachAsync(async (config) => {
|
||||
await ServiceConfiguration.configurations.updateAsync(config._id, {
|
||||
$set: {
|
||||
secret: OAuthEncryption.seal(config.secret)
|
||||
}
|
||||
|
||||
@@ -226,7 +226,7 @@ const isInPasswordSignupFields = (fieldOrFields) => {
|
||||
return signupFields.reduce(
|
||||
(prev, field) => prev && fieldOrFields.includes(field),
|
||||
true,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return signupFields.includes(fieldOrFields);
|
||||
@@ -488,7 +488,7 @@ Template._loginButtonsLoggedOutPasswordlessService.helpers({
|
||||
inSignupFlow: () => loginButtonsSession.get('inSignupFlow'),
|
||||
|
||||
showCreateAccountLink: () => !Accounts._options.forbidClientAccountCreation,
|
||||
})
|
||||
});
|
||||
|
||||
Template._loginButtonsLoggedOutPasswordService.helpers({
|
||||
fields: () => {
|
||||
@@ -565,7 +565,7 @@ Template._loginButtonsLoggedOutPasswordService.helpers({
|
||||
|
||||
Template._loginButtonsFormField.helpers({
|
||||
inputType: function () {
|
||||
return this.inputType || "text"
|
||||
return this.inputType || "text";
|
||||
}
|
||||
});
|
||||
|
||||
@@ -584,7 +584,7 @@ Template._loginButtonsChangePassword.events({
|
||||
|
||||
Template._loginButtonsChangePassword.helpers({
|
||||
fields: () => {
|
||||
const { username, emails } = Meteor.user()
|
||||
const { username, emails } = Meteor.user();
|
||||
let email;
|
||||
if (emails) {
|
||||
email = emails[0].address;
|
||||
|
||||
@@ -34,12 +34,12 @@ try {
|
||||
Meteor.startup(() => {
|
||||
const settings = Meteor.settings?.packages?.['service-configuration'];
|
||||
if (!settings) return;
|
||||
Object.keys(settings).forEach(key => {
|
||||
ServiceConfiguration.configurations.upsert(
|
||||
for (const key of Object.keys(settings)) {
|
||||
ServiceConfiguration.configurations.upsertAsync(
|
||||
{ service: key },
|
||||
{
|
||||
$set: settings[key],
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user