@alfabit/keycloak 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import Keycloak, { type KeycloakInitOptions } from 'keycloak-js';
|
|
2
2
|
import { inject, reactive, readonly, type Ref, ref } from 'vue';
|
|
3
3
|
import { postWebLogin } from '../api/wallet/endpoints';
|
|
4
|
-
import { AppNameEnum, APP_NAME, IS_TELEGRAM_MINI_APP, KEYCLOAK_LOGIN_REQUIRED, OPENID_CLIENT_ID, OPENID_REALM, OPENID_URL } from '@alfabit/constants';
|
|
4
|
+
import { AppNameEnum, APP_NAME, IS_TELEGRAM_MINI_APP, KEYCLOAK_LOGIN_REQUIRED, OPENID_CLIENT_ID, OPENID_REALM, OPENID_URL, LocationEnum } from '@alfabit/constants';
|
|
5
5
|
|
|
6
6
|
export type TIdpHint = 'email' | 'google' | 'apple';
|
|
7
7
|
|
|
@@ -33,10 +33,11 @@ const keycloak = ref<Keycloak | null>(null);
|
|
|
33
33
|
const isAuth = ref(false);
|
|
34
34
|
const checkAuth = ref(false);
|
|
35
35
|
const keycloakUserData = ref<Keycloak.KeycloakTokenParsed | null>(null);
|
|
36
|
+
const locale = ref('en');
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
38
|
+
export const setKeycloakLocale = (newLocale: LocationEnum) => {
|
|
39
|
+
locale.value = newLocale;
|
|
40
|
+
};
|
|
40
41
|
|
|
41
42
|
const isInitialized = ref(false);
|
|
42
43
|
|
|
@@ -165,6 +166,7 @@ export const getAuthMethods = ({ dontChangeRedirectUri = ref(false), keycloakRed
|
|
|
165
166
|
keycloak.value.login({
|
|
166
167
|
redirectUri: redirectUri ?? getUrl(dontChangeRedirectUri.value, keycloakRedirectUriIsLogout.value),
|
|
167
168
|
loginHint: email ?? '',
|
|
169
|
+
locale: locale.value,
|
|
168
170
|
});
|
|
169
171
|
} else {
|
|
170
172
|
console.warn('Keycloak not defined! #login');
|
|
@@ -188,6 +190,7 @@ export const getAuthMethods = ({ dontChangeRedirectUri = ref(false), keycloakRed
|
|
|
188
190
|
keycloak.value.register({
|
|
189
191
|
redirectUri: redirectUri ?? getUrl(dontChangeRedirectUri.value),
|
|
190
192
|
loginHint: email ?? '',
|
|
193
|
+
locale: locale.value,
|
|
191
194
|
});
|
|
192
195
|
} else {
|
|
193
196
|
console.warn('Keycloak not defined! #register');
|
|
@@ -210,6 +213,7 @@ export const getAuthMethods = ({ dontChangeRedirectUri = ref(false), keycloakRed
|
|
|
210
213
|
keycloak.value.login({
|
|
211
214
|
redirectUri: redirectUri ?? getUrl(dontChangeRedirectUri.value),
|
|
212
215
|
idpHint: 'apple',
|
|
216
|
+
locale: locale.value,
|
|
213
217
|
});
|
|
214
218
|
} else {
|
|
215
219
|
console.warn('Keycloak not defined! #loginWithApple');
|
|
@@ -220,6 +224,7 @@ export const getAuthMethods = ({ dontChangeRedirectUri = ref(false), keycloakRed
|
|
|
220
224
|
keycloak.value.login({
|
|
221
225
|
redirectUri: redirectUri ?? getUrl(dontChangeRedirectUri.value),
|
|
222
226
|
idpHint: 'telegram',
|
|
227
|
+
locale: locale.value,
|
|
223
228
|
});
|
|
224
229
|
} else {
|
|
225
230
|
console.warn('Keycloak not defined! #loginWithTelegram');
|