Merge pull request #2259 from Bhanu-mbvg/master

Wikidata login: form submittion by pressing Enter key
This commit is contained in:
Antonin Delpeuch 2019-12-23 11:30:42 +01:00 committed by GitHub
commit 4edbd40b6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 22 deletions

View File

@ -25,11 +25,11 @@
<td><label for="remember-credentials" bind="rememberCredentialsLabel"></label></td> <td><label for="remember-credentials" bind="rememberCredentialsLabel"></label></td>
</tr> </tr>
</table> </table>
</form>
<div class="wikibase-login-buttons"> <div class="wikibase-login-buttons">
<button class="button cancel-button" bind="cancelButton1"></button> <button class="button cancel-button" bind="cancelButton1"></button>
<button class="button button-primary" bind="loginButton"></button> <button class="button button-primary" type="submit" bind="loginButton"></button>
</div> </div>
</form>
</div> </div>
<div class="wikibase-user-logout" bind="logoutArea"> <div class="wikibase-user-logout" bind="logoutArea">
<p><span bind="loggedInAs"></span> <p><span bind="loggedInAs"></span>

View File

@ -54,7 +54,7 @@ ManageAccountDialog.display = function(logged_in_username, saved_credentials, ca
callback(null); callback(null);
}); });
elmts.loginButton.click(function() { elmts.loginForm.submit(function(e) {
frame.hide(); frame.hide();
Refine.postCSRF( Refine.postCSRF(
"command/wikidata/login", "command/wikidata/login",
@ -63,12 +63,15 @@ ManageAccountDialog.display = function(logged_in_username, saved_credentials, ca
if (data.logged_in) { if (data.logged_in) {
dismiss(); dismiss();
callback(data.username); callback(data.username);
} else { }
else {
frame.show(); frame.show();
elmts.invalidCredentials.text("Invalid credentials."); elmts.invalidCredentials.text("Invalid credentials.");
} }
}); });
}); e.preventDefault();
}
);
elmts.logoutButton.click(function() { elmts.logoutButton.click(function() {
Refine.postCSRF( Refine.postCSRF(