add setup=auth
parent
f439497c6a
commit
8c270bb7eb
|
@ -1,4 +1,7 @@
|
|||
<?php
|
||||
// https://cloud.tencent.com/document/product/583/33846
|
||||
// https://cloud.tencent.com/document/product/583/18581
|
||||
// https://cloud.tencent.com/document/product/583/18580
|
||||
|
||||
function printInput($event, $context)
|
||||
{
|
||||
|
@ -166,16 +169,24 @@ function install()
|
|||
var expires = "expires="+expd.toGMTString();
|
||||
document.cookie=\'language=; path=/; \'+expires;
|
||||
</script>
|
||||
<meta http-equiv="refresh" content="3;URL=' . $url . '">', 'Program updating', 201);
|
||||
<meta http-equiv="refresh" content="3;URL=' . $url . '">', 'Program updating', 201, 1);
|
||||
}
|
||||
return output('Jump
|
||||
return message(getconstStr('Success') . '
|
||||
<script>
|
||||
var expd = new Date();
|
||||
expd.setTime(expd.getTime()+(2*60*60*1000));
|
||||
var expires = "expires="+expd.toGMTString();
|
||||
document.cookie=\'language=; path=/; \'+expires;
|
||||
</script>
|
||||
<meta http-equiv="refresh" content="3;URL=' . path_format($_SERVER['base_path'] . '/') . '">', 302);
|
||||
var i = 0;
|
||||
var uploadList = setInterval(function(){
|
||||
if (document.getElementById("dis").style.display=="none") {
|
||||
console.log(i++);
|
||||
} else {
|
||||
clearInterval(uploadList);
|
||||
location.href = "' . path_format($_SERVER['base_path'] . '/') . '";
|
||||
}
|
||||
}, 1000);
|
||||
</script>', 201, 1);
|
||||
}
|
||||
if ($_GET['install1']) {
|
||||
$tmp['timezone'] = $_COOKIE['timezone'];
|
||||
|
@ -199,7 +210,7 @@ function install()
|
|||
if ($tmp['ONEMANAGER_CONFIG_SAVE'] == 'file') {
|
||||
$html = getconstStr('ONEMANAGER_CONFIG_SAVE_FILE') . '<br><a href="' . $_SERVER['base_path'] . '">' . getconstStr('Home') . '</a>';
|
||||
$title = 'Reinstall';
|
||||
return message($html, $title, 201);
|
||||
return message($html, $title, 201, 1);
|
||||
}
|
||||
$html .= '
|
||||
<form action="?install2" method="post" onsubmit="return notnull(this);">
|
||||
|
@ -217,7 +228,7 @@ function install()
|
|||
}
|
||||
</script>';
|
||||
$title = getconstStr('SetAdminPassword');
|
||||
return message($html, $title, 201);
|
||||
return message($html, $title, 201, 1);
|
||||
}
|
||||
}
|
||||
if ($_GET['install0']) {
|
||||
|
@ -228,10 +239,11 @@ language:<br>';
|
|||
$html .= '
|
||||
<label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
|
||||
}
|
||||
if (getConfig('SecretId')==''||getConfig('SecretKey')=='') $html .= '
|
||||
//if (getConfig('SecretId')==''||getConfig('SecretKey')=='')
|
||||
$html .= '
|
||||
<a href="https://console.cloud.tencent.com/cam/capi" target="_blank">' . getconstStr('Create') . ' SecretId & SecretKey</a><br>
|
||||
<label>SecretId:<input name="SecretId" type="text" placeholder="" size=""></label><br>
|
||||
<label>SecretKey:<input name="SecretKey" type="text" placeholder="" size=""></label><br>';
|
||||
<label>SecretKey:<input name="SecretKey" type="password" placeholder="" size=""></label><br>';
|
||||
$html .= '
|
||||
<label><input type="radio" name="ONEMANAGER_CONFIG_SAVE" value="" ' . ('file'==getenv('ONEMANAGER_CONFIG_SAVE')?'':'checked') . '>' . getconstStr('ONEMANAGER_CONFIG_SAVE_ENV') . '</label><br>
|
||||
<label><input type="radio" name="ONEMANAGER_CONFIG_SAVE" value="file" ' . ('file'==getenv('ONEMANAGER_CONFIG_SAVE')?'checked':'') . '>' . getconstStr('ONEMANAGER_CONFIG_SAVE_FILE') . '</label><br>';
|
||||
|
@ -255,7 +267,8 @@ language:<br>';
|
|||
}
|
||||
function notnull(t)
|
||||
{';
|
||||
if (getConfig('SecretId')==''||getConfig('SecretKey')=='') $html .= '
|
||||
//if (getConfig('SecretId')==''||getConfig('SecretKey')=='')
|
||||
$html .= '
|
||||
if (t.SecretId.value==\'\') {
|
||||
alert(\'input SecretId\');
|
||||
return false;
|
||||
|
@ -603,3 +616,53 @@ function addFileToZip($zip, $rootpath, $path = '')
|
|||
}
|
||||
@closedir($path);
|
||||
}
|
||||
|
||||
function changeAuthKey() {
|
||||
if ($_POST['SecretId']!=''&&$_POST['SecretId']!='') {
|
||||
$tmp['SecretId'] = $_POST['SecretId'];
|
||||
$tmp['SecretKey'] = $_POST['SecretKey'];
|
||||
$response = setConfigResponse( SetbaseConfig($tmp, $_SERVER['function_name'], $_SERVER['Region'], $_SERVER['namespace'], $tmp['SecretId'], $tmp['SecretKey']) );
|
||||
if (api_error($response)) {
|
||||
$html = api_error_msg($response);
|
||||
$title = 'Error';
|
||||
return message($html, $title, 400);
|
||||
} else {
|
||||
$html = getconstStr('Success') . '
|
||||
<script>
|
||||
var status = "' . $response['DplStatus'] . '";
|
||||
var i = 0;
|
||||
var uploadList = setInterval(function(){
|
||||
if (document.getElementById("dis").style.display=="none") {
|
||||
console.log(i++);
|
||||
} else {
|
||||
clearInterval(uploadList);
|
||||
location.href = "' . path_format($_SERVER['base_path'] . '/') . '";
|
||||
}
|
||||
}, 1000);
|
||||
</script>';
|
||||
return message($html, $title, 201, 1);
|
||||
}
|
||||
}
|
||||
$html = '
|
||||
<form action="" method="post" onsubmit="return notnull(this);">
|
||||
<a href="https://console.cloud.tencent.com/cam/capi" target="_blank">' . getconstStr('Create') . ' SecretId & SecretKey</a><br>
|
||||
<label>SecretId:<input name="SecretId" type="text" placeholder="" size=""></label><br>
|
||||
<label>SecretKey:<input name="SecretKey" type="password" placeholder="" size=""></label><br>
|
||||
<input type="submit" value="' . getconstStr('Submit') . '">
|
||||
</form>
|
||||
<script>
|
||||
function notnull(t)
|
||||
{
|
||||
if (t.SecretId.value==\'\') {
|
||||
alert(\'input SecretId\');
|
||||
return false;
|
||||
}
|
||||
if (t.SecretKey.value==\'\') {
|
||||
alert(\'input SecretKey\');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
</script>';
|
||||
return message($html, 'Change platform Auth token or key', 200);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue