Merge pull request #13363 from nextcloud/fix/loginflow_apptoken_ios
Fix loginflow with apptoken enter on iOS
This commit is contained in:
commit
076f6b8ed1
|
@ -327,6 +327,18 @@ class ClientFlowLoginController extends Controller {
|
||||||
return new Http\RedirectResponse($redirectUri);
|
return new Http\RedirectResponse($redirectUri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @PublicPage
|
||||||
|
*/
|
||||||
|
public function apptokenRedirect(string $stateToken, string $user, string $password) {
|
||||||
|
if (!$this->isValidToken($stateToken)) {
|
||||||
|
return $this->stateTokenForbiddenResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
$redirectUri = 'nc://login/server:' . $this->getServerPath() . '&user:' . urlencode($user) . '&password:' . urlencode($password);
|
||||||
|
return new Http\RedirectResponse($redirectUri);
|
||||||
|
}
|
||||||
|
|
||||||
private function getServerPath(): string {
|
private function getServerPath(): string {
|
||||||
$serverPostfix = '';
|
$serverPostfix = '';
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,4 @@ jQuery(document).ready(function() {
|
||||||
$('#redirect-link').addClass('hidden');
|
$('#redirect-link').addClass('hidden');
|
||||||
$('#app-token-login-field').removeClass('hidden');
|
$('#app-token-login-field').removeClass('hidden');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#submit-app-token-login').click(function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
window.location.href = 'nc://login/server:'
|
|
||||||
+ encodeURIComponent($('#serverHost').val())
|
|
||||||
+ "&user:" + encodeURIComponent($('#user').val())
|
|
||||||
+ "&password:" + encodeURIComponent($('#password').val());
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -54,6 +54,7 @@ $application->registerRoutes($this, [
|
||||||
['name' => 'ClientFlowLogin#showAuthPickerPage', 'url' => '/login/flow', 'verb' => 'GET'],
|
['name' => 'ClientFlowLogin#showAuthPickerPage', 'url' => '/login/flow', 'verb' => 'GET'],
|
||||||
['name' => 'ClientFlowLogin#generateAppPassword', 'url' => '/login/flow', 'verb' => 'POST'],
|
['name' => 'ClientFlowLogin#generateAppPassword', 'url' => '/login/flow', 'verb' => 'POST'],
|
||||||
['name' => 'ClientFlowLogin#grantPage', 'url' => '/login/flow/grant', 'verb' => 'GET'],
|
['name' => 'ClientFlowLogin#grantPage', 'url' => '/login/flow/grant', 'verb' => 'GET'],
|
||||||
|
['name' => 'ClientFlowLogin#apptokenRedirect', 'url' => '/login/flow/apptoken', 'verb' => 'POST'],
|
||||||
['name' => 'TwoFactorChallenge#selectChallenge', 'url' => '/login/selectchallenge', 'verb' => 'GET'],
|
['name' => 'TwoFactorChallenge#selectChallenge', 'url' => '/login/selectchallenge', 'verb' => 'GET'],
|
||||||
['name' => 'TwoFactorChallenge#showChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'GET'],
|
['name' => 'TwoFactorChallenge#showChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'GET'],
|
||||||
['name' => 'TwoFactorChallenge#solveChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'POST'],
|
['name' => 'TwoFactorChallenge#solveChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'POST'],
|
||||||
|
|
|
@ -44,7 +44,7 @@ $urlGenerator = $_['urlGenerator'];
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<fieldset id="app-token-login-field" class="hidden">
|
<form action="<?php p($urlGenerator->linkToRouteAbsolute('core.ClientFlowLogin.apptokenRedirect')); ?>" method="post" id="app-token-login-field" class="hidden">
|
||||||
<p class="grouptop">
|
<p class="grouptop">
|
||||||
<input type="text" name="user" id="user" placeholder="<?php p($l->t('Username')) ?>">
|
<input type="text" name="user" id="user" placeholder="<?php p($l->t('Username')) ?>">
|
||||||
<label for="user" class="infield"><?php p($l->t('Username')) ?></label>
|
<label for="user" class="infield"><?php p($l->t('Username')) ?></label>
|
||||||
|
@ -53,9 +53,10 @@ $urlGenerator = $_['urlGenerator'];
|
||||||
<input type="password" name="password" id="password" placeholder="<?php p($l->t('App token')) ?>">
|
<input type="password" name="password" id="password" placeholder="<?php p($l->t('App token')) ?>">
|
||||||
<label for="password" class="infield"><?php p($l->t('Password')) ?></label>
|
<label for="password" class="infield"><?php p($l->t('Password')) ?></label>
|
||||||
</p>
|
</p>
|
||||||
<input type="hidden" id="serverHost" value="<?php p($_['serverHost']) ?>" />
|
<input type="hidden" name="stateToken" value="<?php p($_['stateToken']) ?>" />
|
||||||
|
<input type="hidden" name="requesttoken" value="<?php p($_['requesttoken']) ?>">
|
||||||
<input id="submit-app-token-login" type="submit" class="login primary icon-confirm-white" value="<?php p($l->t('Grant access')) ?>">
|
<input id="submit-app-token-login" type="submit" class="login primary icon-confirm-white" value="<?php p($l->t('Grant access')) ?>">
|
||||||
</fieldset>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if(empty($_['oauthState'])): ?>
|
<?php if(empty($_['oauthState'])): ?>
|
||||||
|
|
Loading…
Reference in New Issue