web-manager 2.1.32 → 2.1.33
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +84 -33
- package/package.json +1 -1
package/index.js
CHANGED
@@ -169,7 +169,7 @@ function Manager() {
|
|
169
169
|
this.properties.page.status.eventHandlersSet = true;
|
170
170
|
var This = this;
|
171
171
|
// document.addEventListener('click', function (event) {
|
172
|
-
|
172
|
+
document.addEventListener('click', function (event) {
|
173
173
|
// console.log('Clicked.... NEW');
|
174
174
|
// This.log('Clicked', event.target);
|
175
175
|
// auth events
|
@@ -837,26 +837,45 @@ function Manager() {
|
|
837
837
|
domLib.select(erel).hide().setInnerHTML('');
|
838
838
|
}
|
839
839
|
|
840
|
-
function signinButtonDisabled(status) {
|
840
|
+
// function signinButtonDisabled(status) {
|
841
|
+
// if (status) {
|
842
|
+
// domLib.select('.auth-signin-email-btn').setAttribute('disabled', true);
|
843
|
+
// } else {
|
844
|
+
// domLib.select('.auth-signin-email-btn').removeAttribute('disabled');
|
845
|
+
// }
|
846
|
+
// }
|
847
|
+
// function signupButtonDisabled(status) {
|
848
|
+
// if (status) {
|
849
|
+
// domLib.select('.auth-signup-email-btn').setAttribute('disabled', true);
|
850
|
+
// } else {
|
851
|
+
// domLib.select('.auth-signup-email-btn').removeAttribute('disabled');
|
852
|
+
// }
|
853
|
+
// }
|
854
|
+
// function forgotButtonDisabled(status) {
|
855
|
+
// if (status) {
|
856
|
+
// domLib.select('.auth-forgot-email-btn').setAttribute('disabled', true);
|
857
|
+
// } else {
|
858
|
+
// domLib.select('.auth-forgot-email-btn').removeAttribute('disabled');
|
859
|
+
// }
|
860
|
+
// }
|
861
|
+
|
862
|
+
function setAuthButtonDisabled(button, status) {
|
863
|
+
var el = domLib.select('.auth-' + button + '-email-btn');
|
864
|
+
var disabled = 'disabled';
|
841
865
|
if (status) {
|
842
|
-
|
866
|
+
el.setAttribute(disabled, true);
|
843
867
|
} else {
|
844
|
-
|
868
|
+
el.removeAttribute(disabled);
|
845
869
|
}
|
846
870
|
}
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
if (status) {
|
856
|
-
domLib.select('.auth-forgot-email-btn').setAttribute('disabled', true);
|
857
|
-
} else {
|
858
|
-
domLib.select('.auth-forgot-email-btn').removeAttribute('disabled');
|
859
|
-
}
|
871
|
+
|
872
|
+
function resolveAuthInput(existing, mode, input) {
|
873
|
+
var authSelector = '.auth-';
|
874
|
+
var inputSelector = authSelector + input + '-input';
|
875
|
+
var formSelector = authSelector + mode + '-form ';
|
876
|
+
// var temp
|
877
|
+
|
878
|
+
return existing || domLib.select(formSelector + inputSelector).getValue() || domLib.select(inputSelector).getValue()
|
860
879
|
}
|
861
880
|
|
862
881
|
return {
|
@@ -896,13 +915,20 @@ function Manager() {
|
|
896
915
|
}
|
897
916
|
},
|
898
917
|
signIn: function (method, email, password) {
|
918
|
+
var mode = 'signin';
|
899
919
|
method = method || 'email';
|
900
920
|
_preDisplayError();
|
901
921
|
// This.log('Signin attempt: ', method, email, password);
|
902
922
|
if (method === 'email') {
|
903
|
-
email = (email || domLib.select('.auth-email-input').getValue()).trim().toLowerCase();
|
904
|
-
|
905
|
-
|
923
|
+
// email = (email || domLib.select('.auth-email-input').getValue()).trim().toLowerCase();
|
924
|
+
email = resolveAuthInput(email, mode, 'email').trim().toLowerCase();
|
925
|
+
// password = password || domLib.select('.auth-password-input').getValue();
|
926
|
+
password = resolveAuthInput(password, mode, 'password');
|
927
|
+
// console.log('Signin attempt: ', method, email, password);
|
928
|
+
|
929
|
+
// signinButtonDisabled(true);
|
930
|
+
setAuthButtonDisabled(mode, true);
|
931
|
+
|
906
932
|
firebase.auth().signInWithEmailAndPassword(email, password)
|
907
933
|
.then(function(credential) {
|
908
934
|
// _postAuthSubscriptionCheck(This)
|
@@ -910,11 +936,13 @@ function Manager() {
|
|
910
936
|
//
|
911
937
|
// })
|
912
938
|
This.properties.page.status.didSignIn = true;
|
913
|
-
signinButtonDisabled(false);
|
939
|
+
// signinButtonDisabled(false);
|
940
|
+
setAuthButtonDisabled(mode, false);
|
914
941
|
// This.log('Good signin');
|
915
942
|
})
|
916
943
|
.catch(function(error) {
|
917
|
-
signinButtonDisabled(false);
|
944
|
+
// signinButtonDisabled(false);
|
945
|
+
setAuthButtonDisabled(mode, false);
|
918
946
|
_displayError(error.message);
|
919
947
|
// This.log('Error', error.message);
|
920
948
|
});
|
@@ -927,22 +955,37 @@ function Manager() {
|
|
927
955
|
}
|
928
956
|
},
|
929
957
|
signUp: function(method, email, password, passwordConfirm) {
|
958
|
+
var mode = 'signup';
|
930
959
|
method = method || 'email';
|
931
960
|
|
932
961
|
_preDisplayError();
|
933
962
|
// This.log('Signup attempt: ', method, email, password, passwordConfirm);
|
934
|
-
var
|
935
|
-
|
963
|
+
// var acceptedTerms
|
964
|
+
// var termEl = domLib.select('.auth-terms-input');
|
965
|
+
// if (termEl.exists() && !termEl.getValue() === true) {
|
966
|
+
// _displayError('Please review and accept our terms.');
|
967
|
+
// return;
|
968
|
+
// }
|
969
|
+
var termsSelector = '.auth-terms-input';
|
970
|
+
var termSpecificEl = domLib.select('.auth-signup-form ' + termsSelector)
|
971
|
+
var termGenericEl = domLib.select(termsSelector)
|
972
|
+
if ((termSpecificEl.exists() && !termSpecificEl.getValue() === true) || (termGenericEl.exists() && !termGenericEl.getValue() === true)) {
|
936
973
|
_displayError('Please review and accept our terms.');
|
937
974
|
return;
|
938
975
|
}
|
976
|
+
|
939
977
|
if (method === 'email') {
|
940
|
-
email = (email || domLib.select('.auth-email-input').getValue()).trim().toLowerCase();
|
941
|
-
|
942
|
-
|
978
|
+
// email = (email || domLib.select('.auth-email-input').getValue()).trim().toLowerCase();
|
979
|
+
email = resolveAuthInput(email, mode, 'email').trim().toLowerCase();
|
980
|
+
// password = password || domLib.select('.auth-password-input').getValue();
|
981
|
+
password = resolveAuthInput(password, mode, 'password');
|
982
|
+
// passwordConfirm = passwordConfirm || domLib.select('.auth-password-confirm-input').getValue();
|
983
|
+
passwordConfirm = resolveAuthInput(passwordConfirm, mode, 'password-confirm');
|
984
|
+
// console.log('Signup attempt: ', method, email, password, passwordConfirm);
|
943
985
|
|
944
986
|
if (password === passwordConfirm) {
|
945
|
-
signupButtonDisabled(true);
|
987
|
+
// signupButtonDisabled(true);
|
988
|
+
setAuthButtonDisabled(mode, true);
|
946
989
|
firebase.auth().createUserWithEmailAndPassword(email, password)
|
947
990
|
.then(function(credential) {
|
948
991
|
This.properties.page.status.didSignUp = true;
|
@@ -950,7 +993,8 @@ function Manager() {
|
|
950
993
|
// signupButtonDisabled(false);
|
951
994
|
})
|
952
995
|
.catch(function(error) {
|
953
|
-
signupButtonDisabled(false);
|
996
|
+
// signupButtonDisabled(false);
|
997
|
+
setAuthButtonDisabled(mode, false);
|
954
998
|
_displayError(error.message);
|
955
999
|
// This.log('error', error.message);
|
956
1000
|
});
|
@@ -976,17 +1020,24 @@ function Manager() {
|
|
976
1020
|
},
|
977
1021
|
forgot: function(email) {
|
978
1022
|
// This.log('forgot()');
|
979
|
-
|
980
|
-
|
1023
|
+
var mode = 'forgot';
|
1024
|
+
// email = email || domLib.select('.auth-email-input').getValue();
|
1025
|
+
email = resolveAuthInput(email, mode, 'email').trim().toLowerCase();
|
1026
|
+
|
1027
|
+
// forgotButtonDisabled(true);
|
1028
|
+
setAuthButtonDisabled(mode, true);
|
981
1029
|
_preDisplayError();
|
1030
|
+
|
982
1031
|
firebase.auth().sendPasswordResetEmail(email)
|
983
1032
|
.then(function() {
|
984
|
-
forgotButtonDisabled(false);
|
1033
|
+
// forgotButtonDisabled(false);
|
1034
|
+
setAuthButtonDisabled(mode, false);
|
985
1035
|
// This.log('forgot success.');
|
986
1036
|
_displayError('A reset link has been sent to you.');
|
987
1037
|
})
|
988
1038
|
.catch(function(error) {
|
989
|
-
forgotButtonDisabled(false);
|
1039
|
+
// forgotButtonDisabled(false);
|
1040
|
+
setAuthButtonDisabled(mode, false);
|
990
1041
|
// This.log('forgot failed: ', error);
|
991
1042
|
_displayError(error.message);
|
992
1043
|
});
|
package/package.json
CHANGED