add setup=auth
parent
7fbc9c8285
commit
7d56bde181
|
@ -1,4 +1,6 @@
|
|||
<?php
|
||||
// https://cloud.baidu.com/doc/CFC/s/jjwvz45ex
|
||||
// https://cloud.baidu.com/doc/CFC/s/2jwvz44ns
|
||||
|
||||
function printInput($event, $context)
|
||||
{
|
||||
|
@ -164,16 +166,16 @@ function install()
|
|||
}
|
||||
if ($_GET['install1']) {
|
||||
$tmp['timezone'] = $_COOKIE['timezone'];
|
||||
$SecretId = getConfig('SecretId');
|
||||
if ($SecretId=='') {
|
||||
//$SecretId = getConfig('SecretId');
|
||||
//if ($SecretId=='') {
|
||||
$SecretId = $_POST['SecretId'];
|
||||
$tmp['SecretId'] = $SecretId;
|
||||
}
|
||||
$SecretKey = getConfig('SecretKey');
|
||||
if ($SecretKey=='') {
|
||||
//}
|
||||
//$SecretKey = getConfig('SecretKey');
|
||||
//if ($SecretKey=='') {
|
||||
$SecretKey = $_POST['SecretKey'];
|
||||
$tmp['SecretKey'] = $SecretKey;
|
||||
}
|
||||
//}
|
||||
$response = setConfigResponse(SetbaseConfig($tmp, $SecretId, $SecretKey));
|
||||
if (api_error($response)) {
|
||||
$html = api_error_msg($response);
|
||||
|
@ -207,12 +209,13 @@ 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 .= '
|
||||
<a href="https://console.bce.baidu.com/iam/#/iam/accesslist" target="_blank">'.getconstStr('Create').' Access Key & Secret Key</a><br>
|
||||
<label>Access Key:<input name="SecretId" type="text" placeholder="" size=""></label><br>
|
||||
<label>Secret Key:<input name="SecretKey" type="text" placeholder="" size=""></label><br>';
|
||||
//if (getConfig('SecretId')==''||getConfig('SecretKey')=='')
|
||||
$html .= '
|
||||
<input type="submit" value="'.getconstStr('Submit').'">
|
||||
<a href="https://console.bce.baidu.com/iam/#/iam/accesslist" target="_blank">' . getconstStr('Create') . ' Access Key & Secret Key</a><br>
|
||||
<label>Access Key:<input name="SecretId" type="text" placeholder="" size=""></label><br>
|
||||
<label>Secret Key:<input name="SecretKey" type="password" placeholder="" size=""></label><br>';
|
||||
$html .= '
|
||||
<input type="submit" value="' . getconstStr('Submit') . '">
|
||||
</form>
|
||||
<script>
|
||||
var nowtime= new Date();
|
||||
|
@ -231,7 +234,8 @@ language:<br>';
|
|||
}
|
||||
function notnull(t)
|
||||
{';
|
||||
if (getConfig('SecretId')==''||getConfig('SecretKey')=='') $html .= '
|
||||
//if (getConfig('SecretId')==''||getConfig('SecretKey')=='')
|
||||
$html .= '
|
||||
if (t.SecretId.value==\'\') {
|
||||
alert(\'input Access Key\');
|
||||
return false;
|
||||
|
@ -434,3 +438,54 @@ function addFileToZip($zip, $rootpath, $path = '')
|
|||
function WaitFunction() {
|
||||
return true;
|
||||
}
|
||||
|
||||
function changeAuthKey() {
|
||||
if ($_POST['SecretId']!=''&&$_POST['SecretKey']!='') {
|
||||
$SecretId = $_POST['SecretId'];
|
||||
$tmp['SecretId'] = $SecretId;
|
||||
$SecretKey = $_POST['SecretKey'];
|
||||
$tmp['SecretKey'] = $SecretKey;
|
||||
$response = setConfigResponse(SetbaseConfig($tmp, $SecretId, $SecretKey));
|
||||
if (api_error($response)) {
|
||||
$html = api_error_msg($response);
|
||||
$title = 'Error';
|
||||
return message($html, $title, 400);
|
||||
} else {
|
||||
$html = getconstStr('Success') . '
|
||||
<script>
|
||||
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.bce.baidu.com/iam/#/iam/accesslist" target="_blank">' . getconstStr('Create') . ' Access Key & Secret Key</a><br>
|
||||
<label>Access Key:<input name="SecretId" type="text" placeholder="" size=""></label><br>
|
||||
<label>Secret Key:<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 Access Key\');
|
||||
return false;
|
||||
}
|
||||
if (t.SecretKey.value==\'\') {
|
||||
alert(\'input Secret Key\');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
</script>';
|
||||
return message($html, 'Change platform Auth token or key', 200);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue