mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Merge branch 'pr/2183' into devel
This commit is contained in:
@@ -1125,6 +1125,11 @@ Template.api.loginWithExternalService = {
|
||||
name: "forceApprovalPrompt",
|
||||
type: "Boolean",
|
||||
descr: "If true, forces the user to approve the app's permissions, even if previously approved. Currently only supported with Google."
|
||||
},
|
||||
{
|
||||
name: "userEmail",
|
||||
type: "String",
|
||||
descr: "An email address that the external service will use to pre-fill the login prompt. Currently only supported with Meteor developer accounts."
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@ if (Meteor.isClient) {
|
||||
|
||||
var credentialRequestCompleteCallback =
|
||||
Accounts.oauth.credentialRequestCompleteHandler(callback);
|
||||
MeteorDeveloperAccounts.requestCredential(credentialRequestCompleteCallback);
|
||||
MeteorDeveloperAccounts.requestCredential(options, credentialRequestCompleteCallback);
|
||||
};
|
||||
} else {
|
||||
Accounts.addAutopublishFields({
|
||||
|
||||
@@ -4,7 +4,13 @@ MeteorDeveloperAccounts = {};
|
||||
// @param credentialRequestCompleteCallback {Function} Callback function to call on
|
||||
// completion. Takes one argument, credentialToken on success, or Error on
|
||||
// error.
|
||||
var requestCredential = function (credentialRequestCompleteCallback) {
|
||||
var requestCredential = function (options, credentialRequestCompleteCallback) {
|
||||
// support a callback without options
|
||||
if (! credentialRequestCompleteCallback && typeof options === "function") {
|
||||
credentialRequestCompleteCallback = options;
|
||||
options = null;
|
||||
}
|
||||
|
||||
var config = ServiceConfiguration.configurations.findOne({
|
||||
service: 'meteor-developer'
|
||||
});
|
||||
@@ -20,8 +26,12 @@ var requestCredential = function (credentialRequestCompleteCallback) {
|
||||
METEOR_DEVELOPER_URL + "/oauth2/authorize?" +
|
||||
"state=" + credentialToken +
|
||||
"&response_type=code&" +
|
||||
"client_id=" + config.clientId +
|
||||
"&redirect_uri=" + Meteor.absoluteUrl("_oauth/meteor-developer?close");
|
||||
"client_id=" + config.clientId;
|
||||
|
||||
if (options && options.userEmail)
|
||||
loginUrl += '&user_email=' + encodeURIComponent(options.userEmail);
|
||||
|
||||
loginUrl += "&redirect_uri=" + Meteor.absoluteUrl("_oauth/meteor-developer?close");
|
||||
|
||||
OAuth.showPopup(
|
||||
loginUrl,
|
||||
|
||||
Reference in New Issue
Block a user