Ejemplo n.º 1
0
        private void ResetPassword(object sender, EventArgs e)
        {
            FirebaseAuthService dbFirebase = new FirebaseAuthService();

            dbFirebase.RestPasswordByEmail(email.Text);
            PopupNavigation.Instance.PopAsync(true);
        }
Ejemplo n.º 2
0
        public async Task <User> LoginUser(LoginInput User)
        {
            var authOptions = new FirebaseAuthOptions("AIzaSyDHXodPd4jjaXSzwxrdCzJMptaiMPNeYME");
            var firebase    = new FirebaseAuthService(authOptions);

            User user = new User();

            // Set up data
            var request = new VerifyPasswordRequest()
            {
                Email    = User.Email,
                Password = User.Password
            };

            // Execute login query
            var response = await firebase.VerifyPassword(request);

            // Get Data
            user.Email     = response.Email;
            user.IdToken   = response.IdToken;
            user.ExpiresIn = response.ExpiresIn;
            user.LocalId   = response.LocalId;

            return(user);
        }
        private async Task InternalLoginAsync(string email, string pwd)
        {
            var authOptions         = new FirebaseAuthOptions(Secrets.FIREBASE_API_KEY);
            var firebaseAuthService = new FirebaseAuthService(authOptions);

            var request = new VerifyPasswordRequest()
            {
                Email    = email,
                Password = pwd
            };

            try
            {
                VerifyPasswordResponse response = await firebaseAuthService.VerifyPassword(request);

                _currentUser = new User
                {
                    Email = response.Email,
                    Token = response.IdToken
                };
            }
            catch (FirebaseAuthException e)
            {
                _telemetry.LogError("Error in firebase login", e);
            }
        }
        /// <summary>
        /// Returns a task that can be awaited for completion of ShutDown of Server
        /// </summary>
        /// <param name="serverUINotifier"></param>
        /// <returns></returns>
        public static Task StartTCPListener(IServerUINotifier serverUINotifier)
        {
            IAuthenticationService authenticationService = new FirebaseAuthService();

            serverUINotifier.LogText("Initialized authentication service : " + authenticationService.Name);
            ClientsManager clientsManager = new ClientsManager(serverUINotifier, authenticationService);
            TcpListener    tcpListener    = new TcpListener(IPAddress.Any, 2060);

            tcpListener.Start();

            Action listenForNewConnections = new Action(() =>
            {
                while (true)
                {
                    serverUINotifier.LogText("Listening to socket...");
                    TcpClient tcpClient = tcpListener.AcceptTcpClient();
                    clientsManager.AcceptClient(tcpClient);
                }
            });

            Task listenForNewConnectionsTask = new Task(listenForNewConnections);

            listenForNewConnectionsTask.Start();
            Task shutDownWaitTask = new Task(() => serverUINotifier.ServerWantsShutdown.WaitOne());

            shutDownWaitTask.Start();

            return(Task.WhenAny(new List <Task>()
            {
                listenForNewConnectionsTask, shutDownWaitTask
            }));
        }
Ejemplo n.º 5
0
        internal async Task <string> ConnectApiAsync(string apiKey)
        {
            var authOptions = new FirebaseAuthOptions(apiKey);
            var firebase    = new FirebaseAuthService(authOptions);
            var request     = new VerifyPasswordRequest()
            {
                Email    = EMAIL,
                Password = PASSWORD
            };

            string authToken = String.Empty;

            try
            {
                var response = await firebase.VerifyPassword(request);

                authToken = response.IdToken;

                //authToken = response.RefreshToken;
            }
            catch (FirebaseAuthException e)
            {
                Application.Restart();
            }

            return(authToken);
        }
Ejemplo n.º 6
0
        public async Task <bool> GetForm([FromHeader] string firebaseJWT, [FromBody] Form form)
        {
            if (firebaseJWT is null || form is null)
            {
                return(false);
            }

            Console.WriteLine("JWT: " + firebaseJWT);
            Console.WriteLine(form);
            return(await FirebaseAuthService.CheckToken(false, firebaseJWT));
        }
Ejemplo n.º 7
0
        private async void SignIn()
        {
            FirebaseAuthService dbFirebase = new FirebaseAuthService();
            bool SignInSucssfully          = await dbFirebase.SignInUser(emailEntry.Text, passwordEntry.Text);

            if (SignInSucssfully)
            {
                await Navigation.PushAsync(new MainMasterDetailPage());
            }

            CrossDeviceOrientation.Current.UnlockOrientation();
        }
Ejemplo n.º 8
0
        public MainMasterDetailPage()
        {
            NavigationPage.SetHasNavigationBar(this, false);
            firebaseAuthService = new  FirebaseAuthService();
            InitializeComponent();
            WidthRatio = (float)0.3;


            Detail      = new NavigationPage(new Universites());
            IsPresented = false;
            mainMasterDetailViewModel = new MainMasterDetailViewModel();
            BindingContext            = mainMasterDetailViewModel;
        }
Ejemplo n.º 9
0
    public void Start()
    {
        AnalyticsService.Instance.SetAnalyticsEnabled(useAnalytics);

        if (appKeys != null)
        {
            if (appKeys.SyncVRAppKey != "")
            {
                FirebaseAuthService.SetUseDevelopmentEnvironment(useDevEnvironment);
                StartCoroutine(FirebaseAuthService.Login(appKeys.SyncVRAppKey));
            }
        }
    }
Ejemplo n.º 10
0
        private async void SignUp()
        {
            FirebaseAuthService dbFirebase = new FirebaseAuthService();
            bool CreatedSucssfully         = await dbFirebase.SignUpUser(emailEntry.Text, passwordEntry.Text);

            if (CreatedSucssfully)
            {
                await firebaseViewModel.SavedUser(emailEntry.Text, passwordEntry.Text, userNameEntry.Text);

                String massage = String.Format("رجاء تفقد ايميلك {0} لقد ارسنا لك رابط تفعيل الحساب ",
                                               emailEntry.Text);
                await App.Current.MainPage.DisplayAlert("تأكيد", massage, "موافق");
            }
        }
Ejemplo n.º 11
0
        protected override void Awake()
        {
            base.Awake();

            //_facebook = gameObject.AddComponent<FacebookWrapper>();
#if BF_FIREBASE_ANALITICS
            _firebaseAlnalytics = gameObject.AddComponent <FirebaseAlnalyticsWrapper>();
#endif
            Game = CreateGameService();
            Iap  = CreateInAppPurchaser();

#if BF_FIREBASE_AUTH
            _firebaseAuth = new FirebaseAuthService();
#endif
        }
Ejemplo n.º 12
0
        private void SignUp_Load(object sender, EventArgs e)
        {
            ActiveControl = full_name_text;
            full_name_text.Focus();

            fService = new FirebaseAuthService(FirebaseContants.fAuthOptions);

            client = new FireSharp.FirebaseClient(FirebaseContants.Config);

            if (fService == null || client == null)
            {
                MessageBox.Show("Firebase Connection Failed, Check Your Network Status.");
                Close();
            }
        }
Ejemplo n.º 13
0
        private void FreshootLoginForm_Load(object sender, EventArgs e)
        {
            remember_me_check.Checked = Settings.Default["remember_me"].ToString() == "True";

            if (remember_me_check.Checked)
            {
                email_text.Text    = Settings.Default["email"].ToString();
                password_text.Text = Settings.Default["password"].ToString();
            }

            fService = new FirebaseAuthService(FirebaseContants.fAuthOptions);

            client = new FireSharp.FirebaseClient(FirebaseContants.Config);

            if (fService == null || client == null)
            {
                MessageBox.Show("Firebase Connection Failed, Check Your Network Status.");
                Close();
            }
        }
Ejemplo n.º 14
0
        public LoginViewModel(INavigationService navigationService, IPageDialogService dialogService)
        {
            //set the prism stuff
            _navigationService = navigationService;
            _pageDialogservice = dialogService;

            //set all the delegates command using by the ui
            OnActionClickedCommand = new DelegateCommand(() => ActionClickedAsync());
            OnLoginClickedCommand  = new DelegateCommand(() => OnLogin());
            OnSignupClickedCommand = new DelegateCommand(() => OnSignup());
            OnTappedForgotPassword = new DelegateCommand(() => OnForgotPassword());

            //change the button size depending on the actual screen size
            ButtonFontSize = Xamarin.Forms.Device.GetNamedSize(NamedSize.Large, typeof(Button));

            switch (Xamarin.Forms.Device.RuntimePlatform)
            {
            case Xamarin.Forms.Device.iOS:
                ButtonFontSize = ((double)Xamarin.Forms.DependencyService.Get <IScreenDimensions>().GetScreenHeight()) * BUTTON_FACTOR_IOS;
                break;

            case Xamarin.Forms.Device.Android:
                ButtonFontSize = ((double)Xamarin.Forms.DependencyService.Get <IScreenDimensions>().GetScreenHeight()) * BUTTON_FACTOR_ANDROID;
                break;

            default:
                ButtonFontSize *= 1.0;
                break;
            }

            //intialize the firebase rest api
            _firebase = new FirebaseAuthService(new FirebaseAuthOptions()
            {
                WebApiKey = Secrets.Firebase_Auth_Secret
            });

            LoginActive();
        }
Ejemplo n.º 15
0
        public async Task <User> RegisterUser(LoginInput User)
        {
            User user        = new User();
            var  authOptions = new FirebaseAuthOptions("AIzaSyDHXodPd4jjaXSzwxrdCzJMptaiMPNeYME");
            var  firebase    = new FirebaseAuthService(authOptions);

            // Set up DAta
            var request = new SignUpNewUserRequest
            {
                Email    = User.Email,
                Password = User.Password
            };

            // Execute register query
            SignUpNewUserResponse response = await firebase.SignUpNewUser(request);

            // Extract data
            user.Email     = response.Email;
            user.IdToken   = response.IdToken;
            user.ExpiresIn = response.ExpiresIn;
            user.LocalId   = response.LocalId;

            return(user);
        }
 public void Init(FirebaseAuthService fbAuthService, FirebaseDatabaseService fbDatabaseService)
 {
     firebaseAuthService     = fbAuthService;
     firebaseDatabaseService = fbDatabaseService;
 }