authentication multi-user angularjs with firebase












0















I work on a web-mobile application with angularjs and firebase and I was able to perform a simple authentication with angularjs and firebase, except that in my system I have several types of users and in function each must be redirected to its view. could have more details on how to do it? thank you










share|improve this question



























    0















    I work on a web-mobile application with angularjs and firebase and I was able to perform a simple authentication with angularjs and firebase, except that in my system I have several types of users and in function each must be redirected to its view. could have more details on how to do it? thank you










    share|improve this question

























      0












      0








      0








      I work on a web-mobile application with angularjs and firebase and I was able to perform a simple authentication with angularjs and firebase, except that in my system I have several types of users and in function each must be redirected to its view. could have more details on how to do it? thank you










      share|improve this question














      I work on a web-mobile application with angularjs and firebase and I was able to perform a simple authentication with angularjs and firebase, except that in my system I have several types of users and in function each must be redirected to its view. could have more details on how to do it? thank you







      angularjs firebase






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 26 '18 at 6:29









      Patrick BiyagaPatrick Biyaga

      11




      11
























          1 Answer
          1






          active

          oldest

          votes


















          0














          It's kind of simple. To improve performance, first load all of user from firebase to $rootScope first as array object type. Then, get key-in data from login form and filter with that array object type.



          Here is how to populate data from firebase into AngularJS.



          (function() {
          'use strict';
          var wmApp = angular.module('wmApp');

          wmApp.controller('loginCtrl', LoginCtrl);
          LoginCtrl.$inject = ['$scope', '$http', '$rootScope', '$window','$firebaseObject', '$firebaseArray', '$q'];
          function LoginCtrl($scope, $http, $rootScope, $window, $firebaseObject, $firebaseArray, $q) {
          /* Fuck ya, get KYC operator users from Firebase */
          function getKYCUsers() {
          $scope.showLoading = true;
          var ref = firebase.database().ref().child($rootScope.firebaseUserNode);
          var list = $firebaseArray(ref);
          list.$loaded().then((x) => {
          x.forEach(user => {
          $rootScope.authenticatedUsers.push(user.username);
          });
          }).catch(() => {

          });
          }

          }
          })();





          share|improve this answer
























          • thank you, I'm finishing a demo put on github for more help and I share the link

            – Patrick Biyaga
            Nov 26 '18 at 21:02











          • Hello here is what I could already have github.com/patbi/seedocauth but I would also like 1 - to redirect each type of users on his page 2 - Restrict access to the cat view for patients and visitors, but only accessible to doctors

            – Patrick Biyaga
            Nov 27 '18 at 9:29











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53475770%2fauthentication-multi-user-angularjs-with-firebase%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          It's kind of simple. To improve performance, first load all of user from firebase to $rootScope first as array object type. Then, get key-in data from login form and filter with that array object type.



          Here is how to populate data from firebase into AngularJS.



          (function() {
          'use strict';
          var wmApp = angular.module('wmApp');

          wmApp.controller('loginCtrl', LoginCtrl);
          LoginCtrl.$inject = ['$scope', '$http', '$rootScope', '$window','$firebaseObject', '$firebaseArray', '$q'];
          function LoginCtrl($scope, $http, $rootScope, $window, $firebaseObject, $firebaseArray, $q) {
          /* Fuck ya, get KYC operator users from Firebase */
          function getKYCUsers() {
          $scope.showLoading = true;
          var ref = firebase.database().ref().child($rootScope.firebaseUserNode);
          var list = $firebaseArray(ref);
          list.$loaded().then((x) => {
          x.forEach(user => {
          $rootScope.authenticatedUsers.push(user.username);
          });
          }).catch(() => {

          });
          }

          }
          })();





          share|improve this answer
























          • thank you, I'm finishing a demo put on github for more help and I share the link

            – Patrick Biyaga
            Nov 26 '18 at 21:02











          • Hello here is what I could already have github.com/patbi/seedocauth but I would also like 1 - to redirect each type of users on his page 2 - Restrict access to the cat view for patients and visitors, but only accessible to doctors

            – Patrick Biyaga
            Nov 27 '18 at 9:29
















          0














          It's kind of simple. To improve performance, first load all of user from firebase to $rootScope first as array object type. Then, get key-in data from login form and filter with that array object type.



          Here is how to populate data from firebase into AngularJS.



          (function() {
          'use strict';
          var wmApp = angular.module('wmApp');

          wmApp.controller('loginCtrl', LoginCtrl);
          LoginCtrl.$inject = ['$scope', '$http', '$rootScope', '$window','$firebaseObject', '$firebaseArray', '$q'];
          function LoginCtrl($scope, $http, $rootScope, $window, $firebaseObject, $firebaseArray, $q) {
          /* Fuck ya, get KYC operator users from Firebase */
          function getKYCUsers() {
          $scope.showLoading = true;
          var ref = firebase.database().ref().child($rootScope.firebaseUserNode);
          var list = $firebaseArray(ref);
          list.$loaded().then((x) => {
          x.forEach(user => {
          $rootScope.authenticatedUsers.push(user.username);
          });
          }).catch(() => {

          });
          }

          }
          })();





          share|improve this answer
























          • thank you, I'm finishing a demo put on github for more help and I share the link

            – Patrick Biyaga
            Nov 26 '18 at 21:02











          • Hello here is what I could already have github.com/patbi/seedocauth but I would also like 1 - to redirect each type of users on his page 2 - Restrict access to the cat view for patients and visitors, but only accessible to doctors

            – Patrick Biyaga
            Nov 27 '18 at 9:29














          0












          0








          0







          It's kind of simple. To improve performance, first load all of user from firebase to $rootScope first as array object type. Then, get key-in data from login form and filter with that array object type.



          Here is how to populate data from firebase into AngularJS.



          (function() {
          'use strict';
          var wmApp = angular.module('wmApp');

          wmApp.controller('loginCtrl', LoginCtrl);
          LoginCtrl.$inject = ['$scope', '$http', '$rootScope', '$window','$firebaseObject', '$firebaseArray', '$q'];
          function LoginCtrl($scope, $http, $rootScope, $window, $firebaseObject, $firebaseArray, $q) {
          /* Fuck ya, get KYC operator users from Firebase */
          function getKYCUsers() {
          $scope.showLoading = true;
          var ref = firebase.database().ref().child($rootScope.firebaseUserNode);
          var list = $firebaseArray(ref);
          list.$loaded().then((x) => {
          x.forEach(user => {
          $rootScope.authenticatedUsers.push(user.username);
          });
          }).catch(() => {

          });
          }

          }
          })();





          share|improve this answer













          It's kind of simple. To improve performance, first load all of user from firebase to $rootScope first as array object type. Then, get key-in data from login form and filter with that array object type.



          Here is how to populate data from firebase into AngularJS.



          (function() {
          'use strict';
          var wmApp = angular.module('wmApp');

          wmApp.controller('loginCtrl', LoginCtrl);
          LoginCtrl.$inject = ['$scope', '$http', '$rootScope', '$window','$firebaseObject', '$firebaseArray', '$q'];
          function LoginCtrl($scope, $http, $rootScope, $window, $firebaseObject, $firebaseArray, $q) {
          /* Fuck ya, get KYC operator users from Firebase */
          function getKYCUsers() {
          $scope.showLoading = true;
          var ref = firebase.database().ref().child($rootScope.firebaseUserNode);
          var list = $firebaseArray(ref);
          list.$loaded().then((x) => {
          x.forEach(user => {
          $rootScope.authenticatedUsers.push(user.username);
          });
          }).catch(() => {

          });
          }

          }
          })();






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 26 '18 at 7:01









          PPSheinPPShein

          4,7702483147




          4,7702483147













          • thank you, I'm finishing a demo put on github for more help and I share the link

            – Patrick Biyaga
            Nov 26 '18 at 21:02











          • Hello here is what I could already have github.com/patbi/seedocauth but I would also like 1 - to redirect each type of users on his page 2 - Restrict access to the cat view for patients and visitors, but only accessible to doctors

            – Patrick Biyaga
            Nov 27 '18 at 9:29



















          • thank you, I'm finishing a demo put on github for more help and I share the link

            – Patrick Biyaga
            Nov 26 '18 at 21:02











          • Hello here is what I could already have github.com/patbi/seedocauth but I would also like 1 - to redirect each type of users on his page 2 - Restrict access to the cat view for patients and visitors, but only accessible to doctors

            – Patrick Biyaga
            Nov 27 '18 at 9:29

















          thank you, I'm finishing a demo put on github for more help and I share the link

          – Patrick Biyaga
          Nov 26 '18 at 21:02





          thank you, I'm finishing a demo put on github for more help and I share the link

          – Patrick Biyaga
          Nov 26 '18 at 21:02













          Hello here is what I could already have github.com/patbi/seedocauth but I would also like 1 - to redirect each type of users on his page 2 - Restrict access to the cat view for patients and visitors, but only accessible to doctors

          – Patrick Biyaga
          Nov 27 '18 at 9:29





          Hello here is what I could already have github.com/patbi/seedocauth but I would also like 1 - to redirect each type of users on his page 2 - Restrict access to the cat view for patients and visitors, but only accessible to doctors

          – Patrick Biyaga
          Nov 27 '18 at 9:29




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53475770%2fauthentication-multi-user-angularjs-with-firebase%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Costa Masnaga

          Fotorealismo

          Sidney Franklin