KEYCLOAK-84 add totp remove button functionality

This commit is contained in:
vrockai 2013-10-10 13:59:12 +02:00
parent 91c5fe5e4e
commit a0808ad224
4 changed files with 19 additions and 1 deletions

View file

@ -120,6 +120,10 @@ public class UrlBean {
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();
}

View file

@ -22,7 +22,9 @@
<tr>
<td class="provider"><span class="social googleplus">Google</span></td>
<td class="soft">Connected as john@google.com</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>

View file

@ -164,6 +164,14 @@ public class AccountService {
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)

View file

@ -55,6 +55,10 @@ public class Urls {
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);
}