Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
edulix committed Nov 13, 2023
1 parent c02e5b7 commit a7f83c4
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 42 deletions.
4 changes: 2 additions & 2 deletions avRegistration/login-directive/login-directive.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@
class="error text-danger"
role="alert"
ng-if="error"
ng-bind-html="error"
></div>
ng-i18next
>[html:i18next]({{errorData}}){{error}}</div>
</div>
<div class="input-warn">
<div class="warn-box" ng-if="!form.$valid || sendingData" >
Expand Down
44 changes: 23 additions & 21 deletions avRegistration/login-directive/login-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ angular.module('avRegistration')
scope.isOpenId = attrs.isOpenId;
scope.otlSecret = attrs.otlSecret;
scope.error = null;
scope.errorData = null;
scope.current_alt_auth_method_id = undefined;
scope.alternative_auth_methods = null;

Expand All @@ -68,15 +69,16 @@ angular.module('avRegistration')
// validate csrf token format and data
return angular.fromJson($cookies.get(OIDC_ERROR_COOKIE));
}

scope.oidcError = parseOidcErrorCookie();
if (scope.oidcError) {
scope.selectedAltMethod = scope.oidcError.altAuthMethodId;
scope.error = $i18next(
'avRegistration.loginError.openid-connect.' + scope.oidcError.errorCodename,
{
support: '<a href="mailto:' + ConfigService.contact.email + '" target="_blank">' + ConfigService.contact.email + "</a>"
}
/* jshint ignore:start */
setError(
scope.oidcError.errorCodename,
'avRegistration.loginError.openid-connect.' + scope.oidcError.errorCodename
);
/* jshint ignore:end */
}

// simply redirect to login
Expand Down Expand Up @@ -248,6 +250,9 @@ angular.module('avRegistration')
function setError(errorCodename, error)
{
scope.error = error;
scope.errorData = angular.toJson({
support: '<a href="mailto:' + ConfigService.contact.email + '" target="_blank">' + ConfigService.contact.email + "</a>"
});
if (scope.isOpenId) {
setOIDCErrorCookie(errorCodename);
redirectToLogin();
Expand Down Expand Up @@ -488,7 +493,7 @@ angular.module('avRegistration')
}
);
scope.currentFormStep = 1;
scope.error = null;
setError(null, null);
$timeout(scope.sendingDataTimeout, 3000);
}

Expand All @@ -504,7 +509,10 @@ angular.module('avRegistration')
onAuthCodeSent,
function onError(response) {
$timeout(scope.sendingDataTimeout, 3000);
scope.error = $i18next('avRegistration.errorSendingAuthCode');
setError(
null,
'avRegistration.errorSendingAuthCode'
);
}
);
};
Expand Down Expand Up @@ -659,7 +667,7 @@ angular.module('avRegistration')
}

scope.sendingData = true;
scope.error = null;
setError(null, null);

var sessionStartedAtMs = Date.now();
Authmethod
Expand Down Expand Up @@ -749,20 +757,14 @@ angular.module('avRegistration')
} else {
setError(
"unrecognizedServerResponse",
$i18next(
'avRegistration.loginError.' + scope.method + '.unrecognizedServerResponse',
{support: '<a href="mailto:' + ConfigService.contact.email + '" target="_blank">' + ConfigService.contact.email + "</a>"}
)
'avRegistration.loginError.' + scope.method + '.unrecognizedServerResponse'
);
}
} else {
scope.sendingData = false;
setError(
"invalidServerResponse",
$i18next(
'avRegistration.loginError.' + scope.method + '.invalidServerResponse',
{support: '<a href="mailto:' + ConfigService.contact.email + '" target="_blank">' + ConfigService.contact.email + "</a>"}
)
'avRegistration.loginError.' + scope.method + '.invalidServerResponse'
);
}
},
Expand All @@ -772,10 +774,7 @@ angular.module('avRegistration')

setError(
codename,
$i18next(
'avRegistration.loginError.' + scope.method + '.' + codename,
{support: '<a href="mailto:' + ConfigService.contact.email + '" target="_blank">' + ConfigService.contact.email + "</a>"}
)
'avRegistration.loginError.' + scope.method + '.' + codename
);
}
);
Expand Down Expand Up @@ -1071,7 +1070,10 @@ angular.module('avRegistration')
// find provider
if (!provider)
{
scope.error = $i18next('avRegistration.openidError');
setError(
'providerNotFound',
'avRegistration.loginError.openid-connect.providerNotFound'
);
return;
}

Expand Down
Loading

0 comments on commit a7f83c4

Please sign in to comment.