Skip to content

Commit

Permalink
🐞 smartlink as alternative auth method (#390)
Browse files Browse the repository at this point in the history
Parent issue: sequentech/meta#221
  • Loading branch information
edulix authored and Findeton committed Apr 23, 2024
1 parent 44cb37e commit 8d4fe78
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
6 changes: 3 additions & 3 deletions avRegistration/login-directive/login-directive.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

<!-- Shows the alternative auth method tabs in case there's any -->
<div class="col-sm-12 alternative-auth-methods-tabs" ng-if="alternative_auth_methods">
<ul class="nav nav-tabs">
<ul class="nav nav-tabs" ng-if="method !== 'smart-link'">
<li
class="default-auth-method"
ng-class="{'active': current_alt_auth_method_id == null}"
Expand All @@ -53,7 +53,7 @@
ng-repeat="alt_auth_method in alternative_auth_methods"
ng-class="{'active': current_alt_auth_method_id == alt_auth_method.id, 'disabled': selectedAltMethod !== 'smart-link' && alt_auth_method.auth_method_name === 'smart-link'}"
>
<a ng-click="setCurrentAltAuthMethod(alt_auth_method)">
<a ng-click="setCurrentAltAuthMethod(alt_auth_method, true)">
<i
ng-if="alt_auth_method.icon"
class="{{alt_auth_method.icon}}"
Expand Down Expand Up @@ -97,7 +97,7 @@
<button
type="submit"
class="btn btn-block btn-lg btn-success-action"
ng-if="!isCensusQuery && !isOtl"
ng-if="!isCensusQuery && !isOtl && method !== 'smart-link'"
ng-i18next="avRegistration.loginButton"
ng-click="loginUser(form.$valid)"
tabindex="0"
Expand Down
7 changes: 4 additions & 3 deletions avRegistration/login-directive/login-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ angular.module('avRegistration')
{
scope.error = error;
scope.errorData = angular.toJson({
support: '<a href="mailto:' + ConfigService.contact.email + '" target="_blank">' + ConfigService.contact.email + "</a>"
support: ConfigService.contact.email
});
if (scope.isOpenId) {
setOIDCErrorCookie(errorCodename);
Expand Down Expand Up @@ -808,7 +808,7 @@ angular.module('avRegistration')
* @param {*} altAuthMethod altAuthMethod object
*/
scope.getAltAuthMethodName = function(altAuthMethod) {
var langCode = $window.i18n.lng();
var langCode = $window.i18next.resolvedLanguage;
if (
altAuthMethod.public_name_i18n &&
altAuthMethod.public_name_i18n[langCode]
Expand All @@ -823,7 +823,7 @@ angular.module('avRegistration')
* Sets the current alt auth method
* @param {*} altAuthMethod altAuthMethod object
*/
scope.setCurrentAltAuthMethod = function(altAuthMethod) {
scope.setCurrentAltAuthMethod = function(altAuthMethod, isClick) {
var authevent = angular.copy(scope.base_authevent);
if (altAuthMethod === null) {
scope.current_alt_auth_method_id = null;
Expand All @@ -841,6 +841,7 @@ angular.module('avRegistration')

// smart link cannot be enabled if it doesn't come from the url
if (
!!isClick &&
scope.selectedAltMethod !== 'smart-link' &&
altAuthMethod.auth_method_name === 'smart-link'
) {
Expand Down
Loading

0 comments on commit 8d4fe78

Please sign in to comment.