web-manager 3.0.7 → 3.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/helpers/auth-pages.js +37 -18
- package/index.js +6 -7
- package/package.json +2 -2
package/helpers/auth-pages.js
CHANGED
|
@@ -5,26 +5,45 @@ var dom;
|
|
|
5
5
|
function AuthPages() {
|
|
6
6
|
var self = this;
|
|
7
7
|
dom = window.Manager.dom();
|
|
8
|
-
var authRegex = /\/(signin|signup|forgot)/;
|
|
9
8
|
var pageQueryString = window.Manager.properties.page.queryString;
|
|
10
|
-
var pageAuthRedirect = pageQueryString.get('auth_redirect')
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
})
|
|
27
|
-
}
|
|
10
|
+
dom.select('a[href*=signin], a[href*=signup], a[href*=forgot]').each(function (el) {
|
|
11
|
+
var href = el.getAttribute('href');
|
|
12
|
+
try {
|
|
13
|
+
var newURL = new URL(href);
|
|
14
|
+
pageQueryString.forEach(function(value, key) {
|
|
15
|
+
newURL.searchParams.set(key, value)
|
|
16
|
+
})
|
|
17
|
+
el.setAttribute('href', newURL.toString())
|
|
18
|
+
} catch (e) {
|
|
19
|
+
console.warn('Failed to set auth URL', e);
|
|
20
|
+
}
|
|
21
|
+
})
|
|
28
22
|
}
|
|
29
23
|
|
|
24
|
+
// function AuthPages() {
|
|
25
|
+
// var self = this;
|
|
26
|
+
// dom = window.Manager.dom();
|
|
27
|
+
// var authRegex = /\/(signin|signup|forgot)/;
|
|
28
|
+
// var pageQueryString = window.Manager.properties.page.queryString;
|
|
29
|
+
// var pageAuthRedirect = pageQueryString.get('auth_redirect')
|
|
30
|
+
//
|
|
31
|
+
// if (pageAuthRedirect) {
|
|
32
|
+
// dom.select('a').each(function (el) {
|
|
33
|
+
// var href = el.getAttribute('href');
|
|
34
|
+
// if (href && href.match(authRegex)) {
|
|
35
|
+
// try {
|
|
36
|
+
// var newURL = new URL(href);
|
|
37
|
+
// if (newURL.pathname.match(authRegex)) {
|
|
38
|
+
// newURL.searchParams.set('auth_redirect', pageAuthRedirect)
|
|
39
|
+
// el.setAttribute('href', newURL.toString())
|
|
40
|
+
// }
|
|
41
|
+
// } catch (e) {
|
|
42
|
+
// // console.warn('Failed to set auth URL', e);
|
|
43
|
+
// }
|
|
44
|
+
// }
|
|
45
|
+
// })
|
|
46
|
+
// }
|
|
47
|
+
// }
|
|
48
|
+
|
|
30
49
|
module.exports = AuthPages;
|
package/index.js
CHANGED
|
@@ -816,6 +816,7 @@ function Manager() {
|
|
|
816
816
|
var domLib = This.dom();
|
|
817
817
|
|
|
818
818
|
function _displayError(msg) {
|
|
819
|
+
console.error(msg);
|
|
819
820
|
domLib.select(erel).show().setInnerHTML(msg);
|
|
820
821
|
}
|
|
821
822
|
function _preDisplayError() {
|
|
@@ -858,9 +859,9 @@ function Manager() {
|
|
|
858
859
|
var authSelector = '.auth-';
|
|
859
860
|
var inputSelector = authSelector + input + '-input';
|
|
860
861
|
var formSelector = authSelector + mode + '-form ';
|
|
861
|
-
|
|
862
|
+
var result = existing || domLib.select(formSelector + inputSelector).getValue() || domLib.select(inputSelector).getValue();
|
|
862
863
|
|
|
863
|
-
return
|
|
864
|
+
return input === 'email' ? result.trim().toLowerCase() : result;
|
|
864
865
|
}
|
|
865
866
|
|
|
866
867
|
return {
|
|
@@ -888,7 +889,6 @@ function Manager() {
|
|
|
888
889
|
firebase.auth()
|
|
889
890
|
.getRedirectResult()
|
|
890
891
|
.catch(function (error) {
|
|
891
|
-
console.error(error);
|
|
892
892
|
_displayError(error.message);
|
|
893
893
|
});
|
|
894
894
|
}
|
|
@@ -906,7 +906,7 @@ function Manager() {
|
|
|
906
906
|
// This.log('Signin attempt: ', method, email, password);
|
|
907
907
|
if (method === 'email') {
|
|
908
908
|
// email = (email || domLib.select('.auth-email-input').getValue()).trim().toLowerCase();
|
|
909
|
-
email = resolveAuthInput(email, mode, 'email')
|
|
909
|
+
email = resolveAuthInput(email, mode, 'email');
|
|
910
910
|
// password = password || domLib.select('.auth-password-input').getValue();
|
|
911
911
|
password = resolveAuthInput(password, mode, 'password');
|
|
912
912
|
// console.log('Signin attempt: ', method, email, password);
|
|
@@ -934,7 +934,6 @@ function Manager() {
|
|
|
934
934
|
} else {
|
|
935
935
|
firebase.auth().signInWithRedirect(new firebase.auth.OAuthProvider(method))
|
|
936
936
|
.catch(function (e) {
|
|
937
|
-
console.error(e);
|
|
938
937
|
_displayError(e);
|
|
939
938
|
})
|
|
940
939
|
}
|
|
@@ -961,7 +960,7 @@ function Manager() {
|
|
|
961
960
|
|
|
962
961
|
if (method === 'email') {
|
|
963
962
|
// email = (email || domLib.select('.auth-email-input').getValue()).trim().toLowerCase();
|
|
964
|
-
email = resolveAuthInput(email, mode, 'email')
|
|
963
|
+
email = resolveAuthInput(email, mode, 'email');
|
|
965
964
|
// password = password || domLib.select('.auth-password-input').getValue();
|
|
966
965
|
password = resolveAuthInput(password, mode, 'password');
|
|
967
966
|
// passwordConfirm = passwordConfirm || domLib.select('.auth-password-confirm-input').getValue();
|
|
@@ -1012,7 +1011,7 @@ function Manager() {
|
|
|
1012
1011
|
// This.log('forgot()');
|
|
1013
1012
|
var mode = 'forgot';
|
|
1014
1013
|
// email = email || domLib.select('.auth-email-input').getValue();
|
|
1015
|
-
email = resolveAuthInput(email, mode, 'email')
|
|
1014
|
+
email = resolveAuthInput(email, mode, 'email')
|
|
1016
1015
|
|
|
1017
1016
|
// forgotButtonDisabled(true);
|
|
1018
1017
|
setAuthButtonDisabled(mode, true);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "web-manager",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.8",
|
|
4
4
|
"description": "Easily access important variables such as the query string, current domain, and current page in a single object.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"homepage": "https://itwcreativeworks.com",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@sentry/browser": "^6.
|
|
26
|
+
"@sentry/browser": "^6.19.7",
|
|
27
27
|
"cookieconsent": "^3.1.1",
|
|
28
28
|
"firebase": "^8.10.1",
|
|
29
29
|
"lazysizes": "^5.3.2"
|