1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-13 23:03:32 +00:00

two factor page cleanup

This commit is contained in:
Kyle Spearrin
2017-06-26 22:24:10 -04:00
parent 64784d0e36
commit 1d102cad93
11 changed files with 197 additions and 64 deletions

View File

@@ -45,7 +45,9 @@ function initApiService() {
error: function (jqXHR, textStatus, errorThrown) {
if (jqXHR.responseJSON && jqXHR.responseJSON.TwoFactorProviders2 &&
Object.keys(jqXHR.responseJSON.TwoFactorProviders2).length) {
successWithTwoFactor(jqXHR.responseJSON.TwoFactorProviders2);
self.tokenService.clearTwoFactorToken(tokenRequest.email, function () {
successWithTwoFactor(jqXHR.responseJSON.TwoFactorProviders2);
});
}
else {
error(new ErrorResponse(jqXHR, true));
@@ -56,12 +58,14 @@ function initApiService() {
// Two Factor APIs
ApiService.prototype.postTwoFactorEmail = function (success, error) {
ApiService.prototype.postTwoFactorEmail = function (request, success, error) {
var self = this;
$.ajax({
type: 'POST',
url: self.baseUrl + '/two-factor/send-email?' + token,
dataType: 'json',
url: self.baseUrl + '/two-factor/send-email-login',
dataType: 'text',
contentType: 'application/json; charset=utf-8',
data: JSON.stringify(request),
success: function (response) {
success(response);
},