mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 12:24:07 +02:00
send user to token creation page
This commit is contained in:
parent
a668ea7a4c
commit
5645fdc8b9
5 changed files with 9 additions and 29 deletions
|
@ -6,7 +6,7 @@
|
|||
{
|
||||
"name": "access_token",
|
||||
"label": "Access Token",
|
||||
"help": "This is your OAuth access token to connect this domain-server with your High Fidelity account. <br/>It can be generated by clicking the 'Connect Account' button above.<br/>Alternatively, you can go to the <a href='https://metaverse.highfidelity.com/user/security' target='_blank'>My Security</a> page of your account and generate a token with the 'domains' scope and paste it here.",
|
||||
"help": "This is your OAuth access token to connect this domain-server with your High Fidelity account. <br/>It can be generated by clicking the 'Connect Account' button above.<br/>You can also go to the <a href='https://metaverse.highfidelity.com/user/security' target='_blank'>My Security</a> page of your account and generate a token with the 'domains' scope and paste it here.",
|
||||
"advanced": true
|
||||
},
|
||||
{
|
||||
|
|
|
@ -83,7 +83,7 @@ var viewHelpers = {
|
|||
|
||||
if (setting.href) {
|
||||
form_group += "<a href='" + setting.href + "'style='display: block;' role='button'"
|
||||
+ common_attrs("btn " + setting.classes) + ">"
|
||||
+ common_attrs("btn " + setting.classes) + " target='_blank' onclick='this.blur();'>"
|
||||
+ setting.button_label + "</a>";
|
||||
} else {
|
||||
form_group += "<button " + common_attrs("btn " + setting.classes) + ">"
|
||||
|
@ -131,9 +131,6 @@ $(document).ready(function(){
|
|||
$(window).resize(resizeFn);
|
||||
});
|
||||
|
||||
// check if we have a new access token to post to the domain-server
|
||||
checkForNewAccessToken();
|
||||
|
||||
$('#settings-form').on('click', '.' + Settings.ADD_ROW_BUTTON_CLASS, function(){
|
||||
addTableRow(this);
|
||||
});
|
||||
|
@ -273,12 +270,7 @@ function setupHFAccountButton() {
|
|||
buttonSetting.id = "connect-account-btn";
|
||||
|
||||
|
||||
// This is the hard coded client ID for a localhost domain.
|
||||
// Users who access their domain remotely will in the future need to create an OAuth application and for now
|
||||
// will need to generate an access token the old fashioned way
|
||||
buttonSetting.href = "https://metaverse.highfidelity.com/oauth/authorize?" +
|
||||
"client_id=38e572ed35bc4d34c41fbf1fb4d00071bb7328b3d0ba06d1fba64aa3f44e71e4" +
|
||||
"&redirect_uri=http%3A%2F%2Flocalhost%3A40100%2Fsettings%2F&response_type=token&scope=domains"
|
||||
buttonSetting.href = "http://localhost:3000/user/tokens/new?for_domain_server=true";
|
||||
}
|
||||
|
||||
// use the existing getFormGroup helper to ask for a button
|
||||
|
@ -303,20 +295,6 @@ function postNewAccessToken(access_token) {
|
|||
postSettings(newAccessToken);
|
||||
}
|
||||
|
||||
function checkForNewAccessToken() {
|
||||
// check the fragment for an access token
|
||||
var fragment = urlFragment();
|
||||
var access_token = fragment['access_token'];
|
||||
|
||||
if (typeof access_token !== 'undefined') {
|
||||
// clear the fragment before we refresh
|
||||
window.location.hash = "";
|
||||
|
||||
// we have an access token - send that up to the domain-server
|
||||
postNewAccessToken(access_token);
|
||||
}
|
||||
}
|
||||
|
||||
function disonnectHighFidelityAccount() {
|
||||
// the user clicked on the disconnect account btn - give them a sweet alert to make sure this is what they want to do
|
||||
swal({
|
||||
|
|
|
@ -287,10 +287,11 @@ bool DomainServer::didSetupAccountManagerWithAccessToken() {
|
|||
return resetAccountManagerAccessToken();
|
||||
}
|
||||
|
||||
const QString ACCESS_TOKEN_KEY_PATH = "metaverse.access_token";
|
||||
|
||||
bool DomainServer::resetAccountManagerAccessToken() {
|
||||
if (!_oauthProviderURL.isEmpty()) {
|
||||
// check for an access-token in our settings, can optionally be overidden by env value
|
||||
const QString ACCESS_TOKEN_KEY_PATH = "metaverse.access_token";
|
||||
const QString ENV_ACCESS_TOKEN_KEY = "DOMAIN_SERVER_ACCESS_TOKEN";
|
||||
|
||||
QString accessToken = QProcessEnvironment::systemEnvironment().value(ENV_ACCESS_TOKEN_KEY);
|
||||
|
|
|
@ -33,6 +33,7 @@ public:
|
|||
void setupConfigMap(const QStringList& argumentList);
|
||||
QVariant valueOrDefaultValueForKeyPath(const QString& keyPath);
|
||||
|
||||
QVariantMap& getUserSettingsMap() { return _configMap.getUserConfig(); }
|
||||
QVariantMap& getSettingsMap() { return _configMap.getMergedConfig(); }
|
||||
private:
|
||||
QJsonObject responseObjectForType(const QString& typeValue, bool isAuthenticated = false);
|
||||
|
|
|
@ -65,7 +65,7 @@ public:
|
|||
const QUrl& getAuthURL() const { return _authURL; }
|
||||
void setAuthURL(const QUrl& authURL);
|
||||
bool hasAuthEndpoint() { return !_authURL.isEmpty(); }
|
||||
|
||||
|
||||
void disableSettingsFilePersistence() { _shouldPersistToSettingsFile = false; }
|
||||
|
||||
bool isLoggedIn() { return !_authURL.isEmpty() && hasValidAccessToken(); }
|
||||
|
@ -79,7 +79,7 @@ public:
|
|||
|
||||
public slots:
|
||||
void requestAccessToken(const QString& login, const QString& password);
|
||||
|
||||
|
||||
void requestAccessTokenFinished();
|
||||
void requestProfileFinished();
|
||||
void requestAccessTokenError(QNetworkReply::NetworkError error);
|
||||
|
@ -105,7 +105,7 @@ private:
|
|||
AccountManager();
|
||||
AccountManager(AccountManager const& other); // not implemented
|
||||
void operator=(AccountManager const& other); // not implemented
|
||||
|
||||
|
||||
void persistAccountToSettings();
|
||||
|
||||
void passSuccessToCallback(QNetworkReply* reply);
|
||||
|
|
Loading…
Reference in a new issue