web-manager 3.2.38 → 3.2.39
Sign up to get free protection for your applications and to get access to all the features.
- package/index.js +38 -14
- package/lib/account.js +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
@@ -707,14 +707,14 @@ function Manager() {
|
|
707
707
|
Manager.prototype.auth = function() {
|
708
708
|
var self = this;
|
709
709
|
var firebaseActive = typeof firebase !== 'undefined';
|
710
|
-
var
|
710
|
+
var $error = select('.auth-error-message-element');
|
711
711
|
|
712
712
|
function _displayError(msg) {
|
713
713
|
console.error(msg);
|
714
|
-
|
714
|
+
$error.show().setInnerHTML(msg);
|
715
715
|
}
|
716
716
|
function _preDisplayError() {
|
717
|
-
|
717
|
+
$error.hide().setInnerHTML('');
|
718
718
|
}
|
719
719
|
|
720
720
|
function setAuthButtonDisabled(button, status) {
|
@@ -727,15 +727,33 @@ function Manager() {
|
|
727
727
|
}
|
728
728
|
}
|
729
729
|
|
730
|
-
function
|
731
|
-
var
|
732
|
-
var inputSelector =
|
733
|
-
var formSelector =
|
734
|
-
var
|
730
|
+
function selectAuthInput(mode, input) {
|
731
|
+
var prefix = '.auth-';
|
732
|
+
var inputSelector = prefix + input + '-input';
|
733
|
+
var formSelector = prefix + mode + '-form ';
|
734
|
+
var formInput = select(formSelector + inputSelector);
|
735
|
+
var input = select(inputSelector);
|
736
|
+
|
737
|
+
return formInput.exists() ? formInput : input;
|
738
|
+
}
|
739
|
+
|
740
|
+
function resolveAuthInputValue(existing, mode, input) {
|
741
|
+
var result = existing || selectAuthInput(mode, input).getValue();
|
735
742
|
|
736
743
|
return input === 'email' ? result.trim().toLowerCase() : result;
|
737
744
|
}
|
738
745
|
|
746
|
+
function uxHandler(email, password, passwordConfirm, mode) {
|
747
|
+
if (!email) {
|
748
|
+
selectAuthInput(mode, 'email').get(0).focus();
|
749
|
+
} else {
|
750
|
+
selectAuthInput(mode, 'password').get(0).focus();
|
751
|
+
if (mode === 'signup') {
|
752
|
+
selectAuthInput(mode, 'password-confirm').get(0).focus();
|
753
|
+
}
|
754
|
+
}
|
755
|
+
}
|
756
|
+
|
739
757
|
return {
|
740
758
|
isAuthenticated: function () {
|
741
759
|
return firebaseActive ? !!firebase.auth().currentUser : false;
|
@@ -778,11 +796,14 @@ function Manager() {
|
|
778
796
|
// self.log('Signin attempt: ', method, email, password);
|
779
797
|
if (method === 'email') {
|
780
798
|
// email = (email || select('.auth-email-input').getValue()).trim().toLowerCase();
|
781
|
-
email =
|
799
|
+
email = resolveAuthInputValue(email, mode, 'email');
|
782
800
|
// password = password || select('.auth-password-input').getValue();
|
783
|
-
password =
|
801
|
+
password = resolveAuthInputValue(password, mode, 'password');
|
784
802
|
// console.log('Signin attempt: ', method, email, password);
|
785
803
|
|
804
|
+
// Handler
|
805
|
+
uxHandler(email, password, undefined, mode);
|
806
|
+
|
786
807
|
// signinButtonDisabled(true);
|
787
808
|
setAuthButtonDisabled(mode, true);
|
788
809
|
|
@@ -832,13 +853,16 @@ function Manager() {
|
|
832
853
|
|
833
854
|
if (method === 'email') {
|
834
855
|
// email = (email || select('.auth-email-input').getValue()).trim().toLowerCase();
|
835
|
-
email =
|
856
|
+
email = resolveAuthInputValue(email, mode, 'email');
|
836
857
|
// password = password || select('.auth-password-input').getValue();
|
837
|
-
password =
|
858
|
+
password = resolveAuthInputValue(password, mode, 'password');
|
838
859
|
// passwordConfirm = passwordConfirm || select('.auth-password-confirm-input').getValue();
|
839
|
-
passwordConfirm =
|
860
|
+
passwordConfirm = resolveAuthInputValue(passwordConfirm, mode, 'password-confirm');
|
840
861
|
// console.log('Signup attempt: ', method, email, password, passwordConfirm);
|
841
862
|
|
863
|
+
// Handler
|
864
|
+
uxHandler(email, password, passwordConfirm, mode);
|
865
|
+
|
842
866
|
if (password === passwordConfirm) {
|
843
867
|
// signupButtonDisabled(true);
|
844
868
|
setAuthButtonDisabled(mode, true);
|
@@ -883,7 +907,7 @@ function Manager() {
|
|
883
907
|
// self.log('forgot()');
|
884
908
|
var mode = 'forgot';
|
885
909
|
// email = email || select('.auth-email-input').getValue();
|
886
|
-
email =
|
910
|
+
email = resolveAuthInputValue(email, mode, 'email')
|
887
911
|
|
888
912
|
// forgotButtonDisabled(true);
|
889
913
|
setAuthButtonDisabled(mode, true);
|
package/lib/account.js
CHANGED
@@ -397,9 +397,9 @@ Account.prototype._resolveAccount = function (firebaseUser, account, options) {
|
|
397
397
|
account.personal.gender = account.personal.gender || '';
|
398
398
|
|
399
399
|
account.personal.location = account.personal.location || {};
|
400
|
-
account.personal.location.city = account.personal.location.city || '';
|
401
400
|
account.personal.location.country = account.personal.location.country || '';
|
402
401
|
account.personal.location.region = account.personal.location.region || '';
|
402
|
+
account.personal.location.city = account.personal.location.city || '';
|
403
403
|
|
404
404
|
account.personal.name = account.personal.name || {};
|
405
405
|
account.personal.name.first = account.personal.name.first || '';
|
package/package.json
CHANGED