Commit 8956a9b7 authored by yilkal's avatar yilkal Committed by Commit Bot

Provide user's email during reauthentication.

Provide user's email during reauthetication for the
edu-coexistence flow.

Bug: 1131174
Change-Id: I48407f942c05b0893ebba298a7eb713c77135757
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2468797
Commit-Queue: Yilkal Abe <yilkal@chromium.org>
Reviewed-by: default avatarDan S <danan@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#819050}
parent caf0bf84
......@@ -23,6 +23,8 @@ const METHOD_LIST = ['consentValid', 'consentLogged', 'requestClose', 'error'];
* eduCoexistenceId: (string),
* platformVersion: (string),
* releaseChannel: (string),
* email: (string|undefined),
* readOnlyEmail: (string|undefined),
* }}
*/
export let EduCoexistenceParams;
......@@ -42,6 +44,12 @@ function constructEduCoexistenceUrl(params) {
url.searchParams.set('edu_coexistence_id', params.eduCoexistenceId);
url.searchParams.set('platform_version', params.platformVersion);
url.searchParams.set('release_channel', params.releaseChannel);
if (params.email) {
url.searchParams.set('email', params.email);
if (params.readOnlyEmail) {
url.searchParams.set('read_only_email', params.readOnlyEmail);
}
}
return url;
}
......
......@@ -36,6 +36,7 @@
#include "google_apis/gaia/gaia_urls.h"
#include "google_apis/gaia/google_service_auth_error.h"
#include "google_apis/gaia/oauth2_access_token_manager.h"
#include "net/base/url_util.h"
#include "ui/base/webui/web_ui_util.h"
namespace chromeos {
......@@ -214,6 +215,24 @@ void EduCoexistenceLoginHandler::SendInitializeEduArgs() {
base::SysInfo::OperatingSystemVersion());
params.SetStringKey("releaseChannel", chrome::GetChannelName());
// If the secondary edu account is being reauthenticated, the email address
// will be provided via the url of the webcontent. Example
// chrome://chrome-signin/edu-coexistence?email=testuser1%40gmail.com
content::WebContents* web_contents = web_ui()->GetWebContents();
if (web_contents) {
const GURL& current_url = web_contents->GetURL();
std::string default_email;
if (net::GetValueForKeyInQuery(current_url, "email", &default_email)) {
params.SetStringKey("email", default_email);
std::string read_only_email;
if (net::GetValueForKeyInQuery(current_url, "readOnlyEmail",
&read_only_email)) {
params.SetStringKey("readOnlyEmail", read_only_email);
}
}
}
ResolveJavascriptCallback(base::Value(initialize_edu_args_callback_.value()),
std::move(params));
initialize_edu_args_callback_ = base::nullopt;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment