remoteStorage: split auth allow template

This commit is contained in:
Bart Visscher 2012-08-07 19:31:19 +02:00
parent 34c076e2a8
commit 4e6b4b265b
2 changed files with 37 additions and 51 deletions

View File

@ -60,57 +60,15 @@ if($userId && $appUrl && $categories) {
header('Location: '.$_GET['redirect_uri'].'#access_token='.$existingToken.'&token_type=bearer');
} else {
//params ok, logged in ok, but need to click Allow still:
?>
<!DOCTYPE html>
<html>
<head>
<title>ownCloud</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="../../../core/img/favicon.png" /><link rel="apple-touch-icon-precomposed" href="../../../core/img/favicon-touch.png" />
<link rel="stylesheet" href="../../../core/css/styles.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../core/css/auth.css" type="text/css" media="screen" />
</head>
<body id="body-login">
<div id="login">
<header>
<div id="header">
<img src="../../../core/img/logo.png" alt="ownCloud" />
</div>
</header>
<section id="main">
<div id="oauth">
<h2><img src="../../../core/img/remoteStorage-big.png" alt="remoteStorage" /></h2>
<p><strong><?php $appUrlParts = explode('/', $_GET['redirect_uri']); echo htmlentities($appUrlParts[2]); ?></strong>
requests read &amp; write access to your
<?php
$categories = explode(',', htmlentities($_GET['scope']));
if(!count($categories)) {
echo htmlentities($_GET['scope']);
} else {
echo '<em>'.$categories[0].'</em>';
if(count($categories)==2) {
echo ' and <em>'.$categories[1].'</em>';
} else if(count($categories)>2) {
for($i=1; $i<count($categories)-1; $i++) {
echo ', <em>'.$categories[$i].'</em>';
}
echo ', and <em>'.$categories[$i].'</em>';
}
}
?>.
</p>
<form accept-charset="UTF-8" method="post">
<input id="allow-auth" name="allow" type="submit" value="Allow" />
<input id="deny-auth" name="deny" type="submit" value="Deny" />
</form>
</div>
</section>
</div>
<footer><p class="info"><a href="http://owncloud.org/">ownCloud</a> &ndash; web services under your control</p></footer>
</body>
</html>
<?php
}//end 'need to click Allow still'
$appUrlParts = explode('/', $_GET['redirect_uri']);
$host = $appUrlParts[2];
$categories = explode(',', $_GET['scope']);
OCP\Util::addStyle('', 'auth');
OCP\Template::printGuestPage('remoteStorage', 'auth', array(
'host' => $host,
'categories' => $categories,
));
}//end 'need to click Allow still'
} else {//login not ok
if($currUser) {
die('You are logged in as '.$currUser.' instead of '.htmlentities($userId));

View File

@ -0,0 +1,28 @@
<section id="main">
<div id="oauth">
<h2><img src="<?php echo image_path('', 'remoteStorage-big.png'); ?>" alt="remoteStorage" /></h2>
<p><strong><?php echo $_['host'] ?></strong>
requests read &amp; write access to your
<?php
$categories = $_['categories'];
if(!count($categories)) {
echo $categories[0];
} else {
echo '<em>'.$categories[0].'</em>';
if(count($categories)==2) {
echo ' and <em>'.$categories[1].'</em>';
} else if(count($categories)>2) {
for($i=1; $i<count($categories)-1; $i++) {
echo ', <em>'.$categories[$i].'</em>';
}
echo ', and <em>'.$categories[$i].'</em>';
}
}
?>.
</p>
<form accept-charset="UTF-8" method="post">
<input id="allow-auth" name="allow" type="submit" value="Allow" />
<input id="deny-auth" name="deny" type="submit" value="Deny" />
</form>
</div>
</section>