Merge pull request #2259 from Bhanu-mbvg/master
Wikidata login: form submittion by pressing Enter key
This commit is contained in:
commit
4edbd40b6a
@ -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>
|
||||||
|
@ -48,27 +48,30 @@ ManageAccountDialog.display = function(logged_in_username, saved_credentials, ca
|
|||||||
elmts.loggedInUsername
|
elmts.loggedInUsername
|
||||||
.text(logged_in_username)
|
.text(logged_in_username)
|
||||||
.attr('href', 'https://www.wikidata.org/wiki/User:'+logged_in_username);
|
.attr('href', 'https://www.wikidata.org/wiki/User:'+logged_in_username);
|
||||||
|
|
||||||
frame.find('.cancel-button').click(function() {
|
frame.find('.cancel-button').click(function() {
|
||||||
dismiss();
|
dismiss();
|
||||||
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",
|
||||||
elmts.loginForm.serialize(),
|
elmts.loginForm.serialize(),
|
||||||
function(data) {
|
function(data) {
|
||||||
if (data.logged_in) {
|
if (data.logged_in) {
|
||||||
dismiss();
|
dismiss();
|
||||||
callback(data.username);
|
callback(data.username);
|
||||||
} else {
|
}
|
||||||
frame.show();
|
else {
|
||||||
elmts.invalidCredentials.text("Invalid credentials.");
|
frame.show();
|
||||||
}
|
elmts.invalidCredentials.text("Invalid credentials.");
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
elmts.logoutButton.click(function() {
|
elmts.logoutButton.click(function() {
|
||||||
Refine.postCSRF(
|
Refine.postCSRF(
|
||||||
@ -79,7 +82,7 @@ ManageAccountDialog.display = function(logged_in_username, saved_credentials, ca
|
|||||||
dismiss();
|
dismiss();
|
||||||
callback(null);
|
callback(null);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -95,7 +98,7 @@ ManageAccountDialog.isLoggedIn = function(callback) {
|
|||||||
ManageAccountDialog.firstLogin = false;
|
ManageAccountDialog.firstLogin = false;
|
||||||
callback(data.username);
|
callback(data.username);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
ManageAccountDialog.ensureLoggedIn = function(callback) {
|
ManageAccountDialog.ensureLoggedIn = function(callback) {
|
||||||
ManageAccountDialog.isLoggedIn(function(logged_in_username) {
|
ManageAccountDialog.isLoggedIn(function(logged_in_username) {
|
||||||
|
Loading…
Reference in New Issue
Block a user