Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions js/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,17 @@
$(document).ready(function(){
var $loginMessage = $('#body-login').find('#message');
if ($loginMessage.length) {
var client = $("data[key='oauth2']").attr('value');
var msg = t('oauth2', 'The application "{app}" is requesting access to your account. To authorize it, please log in first.', {app : client});
var data = $("data[key='oauth2']");
var msg = t('oauth2', 'The application "{app}" is requesting access to your account. To authorize it, please log in first.', {app : data.attr('client')});
$loginMessage.parent().append('<div class="warning"><div class="icon-info-white" />'+msg+'</div>');
var user = data.attr('user');
if (user) {
$('#password')
.val('')
.get(0).focus();
$('#user')
.val(user)
.prop('readonly', true);
}
}
});
6 changes: 5 additions & 1 deletion lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ public function boot() {
$client = $mapper->findByIdentifier($params['client_id']);
\OCP\Util::addScript('oauth2', 'login');
\OCP\Util::addStyle('oauth2', 'login');
\OCP\Util::addHeader('data', ['key' => 'oauth2', 'value' => $client->getName()]);
$data = ['key' => 'oauth2', 'client' => $client->getName()];
if (isset($params['user'])) {
$data['user'] = $params['user'];
}
\OCP\Util::addHeader('data', $data);
} catch (DoesNotExistException $ex) {
// ignore - the given client id is not known
}
Expand Down