Support to get/set/delete/generate an HTTP password via REST
The HTTP password of a user can now be retrieved by GET on /accounts/<account-id>/password.http. By PUT on /accounts/<account-id>/password.http a new HTTP password can be generated or set. Directly setting an HTTP password is only allowed for Gerrit administrators. By DELETE on /accounts/<account-id>/password.http the HTTP password can be cleared. The WebUI is adapted to use the new REST endpoints to generate/clear the HTTP password. The old RPCs for this are deleted. Change-Id: I1424f1d4b45e5409095b51f05c9c6afe26e66800 Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:

committed by
Edwin Kempin

parent
12c35d3ed8
commit
d9cdf5eea4
@@ -17,7 +17,9 @@ package com.google.gerrit.client.account;
|
||||
import static com.google.gerrit.reviewdb.client.AccountExternalId.SCHEME_USERNAME;
|
||||
|
||||
import com.google.gerrit.client.Gerrit;
|
||||
import com.google.gerrit.client.VoidResult;
|
||||
import com.google.gerrit.client.rpc.GerritCallback;
|
||||
import com.google.gerrit.client.rpc.NativeString;
|
||||
import com.google.gerrit.client.rpc.ScreenLoadCallback;
|
||||
import com.google.gerrit.reviewdb.client.AccountExternalId;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
@@ -152,10 +154,12 @@ public class MyPasswordScreen extends SettingsScreen {
|
||||
private void doGeneratePassword() {
|
||||
if (id != null) {
|
||||
enableUI(false);
|
||||
Util.ACCOUNT_SEC.generatePassword(id.getKey(),
|
||||
new GerritCallback<AccountExternalId>() {
|
||||
public void onSuccess(final AccountExternalId result) {
|
||||
display(result);
|
||||
AccountApi.generateHttpPassword("self",
|
||||
new GerritCallback<NativeString>() {
|
||||
@Override
|
||||
public void onSuccess(NativeString newPassword) {
|
||||
id.setPassword(newPassword.asString());
|
||||
display(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -169,10 +173,12 @@ public class MyPasswordScreen extends SettingsScreen {
|
||||
private void doClearPassword() {
|
||||
if (id != null) {
|
||||
enableUI(false);
|
||||
Util.ACCOUNT_SEC.clearPassword(id.getKey(),
|
||||
new GerritCallback<AccountExternalId>() {
|
||||
public void onSuccess(final AccountExternalId result) {
|
||||
display(result);
|
||||
AccountApi.clearHttpPassword("self",
|
||||
new GerritCallback<VoidResult>() {
|
||||
@Override
|
||||
public void onSuccess(VoidResult result) {
|
||||
id.setPassword(null);
|
||||
display(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user