Skip to content
Closed
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
4 changes: 4 additions & 0 deletions forms/src/main/java/org/keycloak/forms/UrlBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ public String getTotpUrl() {
return Urls.accountTotpPage(baseURI, realm.getId()).toString();
}

public String getTotpRemoveUrl() {
return Urls.accountTotpRemove(baseURI, realm.getId()).toString();
}

public String getEmailVerificationUrl() {
return Urls.accountEmailVerification(baseURI, realm.getId()).toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
<tr>
<td class="provider"><span class="social googleplus">Google</span></td>
<td class="soft">Connected as [email protected]</td>
<td class="action"><a href="user-totp-setup.html" class="button">Remove Google</a></td>
<td class="action">
<a href="${url.totpRemoveUrl}" class="button">Remove Google</a>
</td>
</tr>
</tbody>
</table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,14 @@ private AccessCodeEntry getAccessCodeEntry(RequiredAction requiredAction) {
return accessCodeEntry;
}

@Path("totp-remove")
@GET
public Response processTotpRemove() {
UserModel user = getUserFromAuthManager();
user.setTotp(false);
return Flows.forms(realm, request, uriInfo).setUser(user).forwardToTotp();
}

@Path("totp")
@POST
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ public static URI accountTotpPage(URI baseUri, String realmId) {
return accountBase(baseUri).path(AccountService.class, "totpPage").build(realmId);
}

public static URI accountTotpRemove(URI baseUri, String realmId) {
return accountBase(baseUri).path(AccountService.class, "processTotpRemove").build(realmId);
}

public static URI accountEmailVerification(URI baseUri, String realmId) {
return accountBase(baseUri).path(AccountService.class, "emailVerification").build(realmId);
}
Expand Down