Beispiel #1
0
        async void CreateAccountGoogleAuth(GoogleUserInfo googleUser)
        {
            User user = new User(googleUser.given_name, googleUser.family_name, googleUser.email);
            HttpClientRequests requests = new HttpClientRequests(googleUser.email, "LOLILOL12");             //todo check how to deal with password

            //I try to login to check if the account is already sign up
            Login(requests);

            //if I'm not signed up I sign up
            var response = await requests.SignUp(user);

            if (response == System.Net.HttpStatusCode.OK)
            {
                // I login as soon as i have created the account on the server
                Login(requests);
            }
            else
            {
                await DisplayAlert("Sign up failed", response.ToString(), "KO");
            }
        }
Beispiel #2
0
        async void SignUp(object sender, EventArgs e)
        {
            string             firstName = Entry_FirstName.Text;
            string             lastName  = Entry_lastName.Text;
            string             password  = Entry_Password.Text;
            string             email     = Entry_Email.Text;
            HttpClientRequests requests  = new HttpClientRequests(email, password);
            User user     = new User(firstName, lastName, email);
            var  response = await requests.SignUp(user);

            //if sign up success redirect to login page
            if (response == System.Net.HttpStatusCode.OK)
            {
                await DisplayAlert("Sign up", "Account created !", "OK");

                await Navigation.PopAsync();                 //remove the current screen
            }
            else
            {
                await DisplayAlert("Sign up failed", response.ToString(), "KO");
            }
        }