示例#1
0
        public IActionResult Signup(SignUp p)
        {
            try
            {
                _applicationService.SignUp(username: p.Username, email: p.Email, password: p.Password);
            }
            catch (SignUpException ex)
            {
                return HttpBadRequest(ex.Message);                
            }

            return new NoContentResult();
        }
示例#2
0
        public void CreateUser(SignUpEntity sg)
        {
            //will write logic to insert in to DB using Entity Framework

            using (var db = new Resturant_Sign_DBContext())
            {
                var insert = new SignUp();
                insert.FirstName = sg.FirstName;
                insert.LastName = sg.LastName;
                insert.Emailaddress = sg.Email;
                insert.Password = sg.Password;
                db.SignUps.Add(insert);
                db.SaveChanges();

            }
        }
示例#3
0
        private async Task<IActionResult> RegisterUser(RegisterViewModel model, string returnUrl, bool useAP)
        {
            //Create the user object and validate it before calling Fraud Protection
            var user = new ApplicationUser
            {
                UserName = model.User.Email,
                Email = model.User.Email,
                FirstName = model.User.FirstName,
                LastName = model.User.LastName,
                PhoneNumber = model.User.Phone,
                Address1 = model.Address.Address1,
                Address2 = model.Address.Address2,
                City = model.Address.City,
                State = model.Address.State,
                ZipCode = model.Address.ZipCode,
                CountryRegion = model.Address.CountryRegion
            };

            foreach (var v in _userManager.UserValidators)
            {
                var validationResult = await v.ValidateAsync(_userManager, user);
                if (!validationResult.Succeeded)
                {
                    AddErrors(validationResult);
                }
            };

            foreach (var v in _userManager.PasswordValidators)
            {
                var validationResult = await v.ValidateAsync(_userManager, user, model.Password);
                if (!validationResult.Succeeded)
                {
                    AddErrors(validationResult);
                }
            };

            if (ModelState.ErrorCount > 0)
            {
                return View("Register", model);
            }

            #region Fraud Protection Service
            var correlationId = _fraudProtectionService.NewCorrelationId;

            // Ask Fraud Protection to assess this signup/registration before registering the user in our database, etc.
            if (useAP)
            {
                AccountProtection.SignUp signupEvent = CreateSignupAPEvent(model);

                var signupAssessment = await _fraudProtectionService.PostSignupAP(signupEvent, correlationId);

                //Track Fraud Protection request/response for display only
                var fraudProtectionIO = new FraudProtectionIOModel(correlationId, signupEvent, signupAssessment, "Signup");
                TempData.Put(FraudProtectionIOModel.TempDataKey, fraudProtectionIO);

                bool rejectSignup = false;
                if (signupAssessment is ResponseSuccess signupResponse)
                {
                    rejectSignup = signupResponse.ResultDetails.FirstOrDefault()?.Decision != DecisionName.Approve;
                }

                if (rejectSignup)
                {
                    ModelState.AddModelError("", "Signup rejected by Fraud Protection. You can try again as it has a random likelihood of happening in this sample site.");
                    return View("Register", model);
                }
            }
            else
            {
                SignUp signupEvent = CreateSignupEvent(model);

                var signupAssessment = await _fraudProtectionService.PostSignup(signupEvent, correlationId);

                //Track Fraud Protection request/response for display only
                var fraudProtectionIO = new FraudProtectionIOModel(correlationId, signupEvent, signupAssessment, "Signup");

                //2 out of 3 signups will succeed on average. Adjust if you want more or less signups blocked for tesing purposes.
                var rejectSignup = new Random().Next(0, 3) != 0;
                var signupStatusType = rejectSignup ? SignupStatusType.Rejected.ToString() : SignupStatusType.Approved.ToString();

                var signupStatus = new SignupStatusEvent
                {
                    SignUpId = signupEvent.SignUpId,
                    StatusType = signupStatusType,
                    StatusDate = DateTimeOffset.Now,
                    Reason = "User is " + signupStatusType
                };

                if (!rejectSignup)
                {
                    signupStatus.User = new SignupStatusUser { UserId = model.User.Email };
                }

                var signupStatusResponse = await _fraudProtectionService.PostSignupStatus(signupStatus, correlationId);

                fraudProtectionIO.Add(signupStatus, signupStatusResponse, "Signup Status");

                TempData.Put(FraudProtectionIOModel.TempDataKey, fraudProtectionIO);

                if (rejectSignup)
                {
                    ModelState.AddModelError("", "Signup rejected by Fraud Protection. You can try again as it has a random likelihood of happening in this sample site.");
                    return View("Register", model);
                }
            }
            #endregion

            var result = await _userManager.CreateAsync(user, model.Password);
            if (!result.Succeeded)
            {
                AddErrors(result);
                return View("Register", model);
            }

            await _signInManager.SignInAsync(user, isPersistent: false);

            await TransferBasketToEmailAsync(user.Email);

            return RedirectToLocal(returnUrl);
        }
示例#4
0
 private void metroButton1_Click(object sender, EventArgs e)
 {
     SignUp?.Invoke(this, EventArgs.Empty);
 }
        public JsonResult GetSignUp(SignUp SignUp)
        {
            var signuplist = SignUpDal.ListAllSignUp();

            return(Json(signuplist, JsonRequestBehavior.AllowGet));
        }
示例#6
0
        public async Task <SignupResponse> PostSignup(SignUp signup, string correlationId)
        {
            var response = await PostAsync(_settings.Endpoints.Signup, signup, correlationId);

            return(await Read <SignupResponse>(response));
        }
示例#7
0
        public ActionResult Delete(string id)
        {
            SignUp sign = club.SignUps.Where(x => x.UserName == id).FirstOrDefault();

            return(View(sign));
        }
 public void Click_SignUp()
 {
     SignUp.SendKeys(Parameters.GetData <string>("email"));
 }
示例#9
0
 public async Task <AccountResult> SignUp(SignUp entity) =>
 await _accountService.SignUp(entity);
示例#10
0
        // AUTHETICATION ERROR HANDLERS ___________________________________________

        // This function handles the status of each authetication and redirects user to
        // appropiate page or gives them an alert message to find out what they should do next.

        async void RedirectUserBasedOnVerification(string status, string direction)
        {
            try
            {
                if (status.Contains("SUCCESSFUL:"))
                {
                    UserDialogs.Instance.HideLoading();

                    //Debug.WriteLine("DIRECTION VALUE: " + direction);
                    //if (direction == "")
                    //{
                    //    Application.Current.MainPage = new DeliveriesPage();
                    //}
                    //else
                    //{
                    Application.Current.MainPage = new DeliveriesPage();

                    //Dictionary<string, Page> array = new Dictionary<string, Page>();

                    //array.Add("ServingFresh.Views.CheckoutPage", new CheckoutPage());
                    //array.Add("ServingFresh.Views.SelectionPage", new SelectionPage());
                    //array.Add("ServingFresh.Views.HistoryPage", new HistoryPage());
                    //array.Add("ServingFresh.Views.RefundPage", new RefundPage());
                    //array.Add("ServingFresh.Views.ProfilePage", new ProfilePage());
                    //array.Add("ServingFresh.Views.ConfirmationPage", new ConfirmationPage());
                    //array.Add("ServingFresh.Views.InfoPage", new InfoPage());

                    //var root = Application.Current.MainPage;
                    //Application.Current.MainPage = array[root.ToString()];
                    //}
                }
                else if (status == "USER NEEDS TO SIGN UP")
                {
                    UserDialogs.Instance.HideLoading();


                    var client = new SignUp();

                    if (userToSignUp != null)
                    {
                        if (userToSignUp.platform != "DIRECT")
                        {
                            var result = await client.FastSignUp(userToSignUp);

                            if (result)
                            {
                                Application.Current.MainPage = new DeliveriesPage();
                            }
                            else
                            {
                                await Application.Current.MainPage.DisplayAlert("Oops", "We were not able to create an account. Please try again.", "OK");
                            }
                        }
                        else
                        {
                            await Navigation.PushModalAsync(new DriverCredentialsVerificationPage(userToSignUp.email, userToSignUp.password));
                        }
                    }
                    else
                    {
                        await Application.Current.MainPage.DisplayAlert("Oops", "We were not able to create an account. Please try again.", "OK");
                    }



                    //if (messageList != null)
                    //{
                    //    if (messageList.ContainsKey("701-000037"))
                    //    {
                    //        await Application.Current.MainPage.DisplayAlert(messageList["701-000037"].title, messageList["701-000037"].message, messageList["701-000037"].responses);
                    //    }
                    //    else
                    //    {
                    //        await Application.Current.MainPage.DisplayAlert("Oops", "It looks like you don't have an account with Serving Fresh. Please sign up!", "OK");
                    //    }
                    //}
                    //else
                    //{
                    //    await Application.Current.MainPage.DisplayAlert("Oops", "It looks like you don't have an account with Serving Fresh. Please sign up!", "OK");
                    //}

                    //await Application.Current.MainPage.DisplayAlert("Oops", "It looks like you don't have an account with Just Delivered. Please sign up!", "OK");
                    //await Navigation.PopModalAsync(false);
                    //await Application.Current.MainPage.Navigation.PushModalAsync(new AddressPage(), true);
                }
                else if (status == "WRONG DIRECT PASSWORD")
                {
                    UserDialogs.Instance.HideLoading();
                    await DisplayAlert("Error", "Wrong password was entered", "OK");
                }
                else if (status == "WRONG SOCIAL MEDIA TO SIGN IN")
                {
                    UserDialogs.Instance.HideLoading();
                    await Application.Current.MainPage.DisplayAlert("Oops", "Our records show that you have attempted to log in with a different social media account. Please log in through the correct social media platform. Thanks!", "OK");
                }
                else if (status == "SIGN IN DIRECTLY")
                {
                    UserDialogs.Instance.HideLoading();
                    await Application.Current.MainPage.DisplayAlert("Oops", "Our records show that you have attempted to log in with a social media account. Please log in through our direct log in. Thanks!", "OK");
                }
                else if (status == "ERROR1")
                {
                    UserDialogs.Instance.HideLoading();
                    await Application.Current.MainPage.DisplayAlert("Oops", "There was an error getting your account. Please contact customer service", "OK");
                }
                else if (status == "ERROR2")
                {
                    UserDialogs.Instance.HideLoading();
                    await Application.Current.MainPage.DisplayAlert("Oops", "There was an error getting your account. Please contact customer service", "OK");
                }
                else
                {
                    UserDialogs.Instance.HideLoading();
                    await Application.Current.MainPage.DisplayAlert("Oops", "There was an error getting your account. Please contact customer service", "OK");
                }
            }
            catch (Exception errorRedirectUserBaseOnVerification)
            {
                //var client = new Diagnostic();
                //client.parseException(errorRedirectUserBaseOnVerification.ToString(), user);

                Debug.Write("ERROR IN 'RedirectUserBasedOnVerification' FUNCTION: " + errorRedirectUserBaseOnVerification.Message);
            }
        }
示例#11
0
        public void doSignup(object sender, EventArgs args)
        {
            if (txtAddr.Text.Trim() == "" || txtfName.Text.Trim() == "" || txtlName.Text.Trim() == "" || txtMobile.Text.Trim() == "" || txtConform.Text.Trim() == "" || txtPasswordEle.Text.Trim() == "" || txtUsername.Text.Trim() == "")
            {
                msg.Text = "All field should not be eampty !";
                txtUsername.Focus();
                return;
            }
            if (txtPasswordEle.Text.Trim().Length < 6)
            {
                msg.Text = "Password should be more than 7 characters long !";
                txtPasswordEle.Focus();
                return;
            }



            if (txtUsername.Text.Trim().Length < 5)
            {
                msg.Text = "Username should me more than 4 characters long !";
                txtUsername.Focus();
                return;
            }

            if (txtMobile.Text.Trim().Length < 10)
            {
                msg.Text = "InValid Mobile Number !";
                txtMobile.Focus();
                return;
            }
            if (txtConform.Text.Trim().Equals(txtPasswordEle.Text.Trim()))
            {
            }
            else
            {
                msg.Text = "Password and Conform are not matching  !";
                txtPasswordEle.Focus();
                return;
            }
            if (!Regex.IsMatch(txtUsername.Text.Trim(), @"^[a-zA-Z0-9@_.]*$"))
            {
                msg.Text = "Username should have only alphanumeric and @ . _ characters !";
                txtUsername.Focus();
                return;
            }
            if (!Regex.IsMatch(txtMobile.Text.Trim(), @"^[0-9]*$"))
            {
                msg.Text = "Mobile Number invailed ";
                txtMobile.Focus();
                return;
            }


            string gender = "other";
            SignUp signUp = new SignUp();

            if (male.Checked == true)
            {
                gender = male.Text.Trim();
            }
            else if (female.Checked == true)
            {
                gender = female.Text.Trim();
            }
            if (signUp.doSignUp(txtUsername.Text.Trim(), txtPasswordEle.Text.Trim(), txtMobile.Text.Trim(), txtfName.Text.Trim(), txtlName.Text.Trim(), gender.Trim(), txtAddr.Text.Trim()))
            {
                Session["user"] = txtUsername.Text.Trim();
                Response.Redirect("eleHome.aspx");
            }
            else
            {
                msg.Text = "Sorry ! Try Again something wrong (Duplicate Username)..";
            }
        }
示例#12
0
 public ActionResult SignUp(SignUp command, string returnUrl)
 {
     return Handle(command, () => GetRedirectResult(returnUrl), () => RedirectToAction("SignUp", "Account"));
 }
示例#13
0
        public async Task <SignUp> UserSignUpCreateAsync(SignUp signup)
        {
            var userdetails = await _repository.UserSignUpCreateAsync(signup);

            return(signup);
        }
示例#14
0
 public async Task <IActionResult> SignUp(SignUp command)
 => Ok(await userService.RegisterAsync(command.FirstName, command.LastName, command.Email, command.Password));
示例#15
0
 public async Task HandleAsync(SignUp command)
 => await CreateAsync(command);
示例#16
0
 private void signUpToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (trafficMonitor.User.Name != "")
     {
         MessageBox.Show(trafficMonitor.User.Name + " you are already logged in!");
     }
     else
     {
         var signup = new SignUp();
         signup.Show();
     }
 }
示例#17
0
 public ActionResult SignUp(SignUp command, string returnUrl)
 {
     return Handle(command, GetRedirectResult(returnUrl));
 }
示例#18
0
        public ActionResult <SignUp> Insert([FromBody] SignUp param)
        {
            if (param == null)
            {
                param          = new SignUp();
                param._message = _localizer["No parameters."];
                return(BadRequest(param));
            }
            param.TermAddr   = "0:0:0:0"; //TODO今後端末単位の管理をするなら
            param.RemoteAddr = HttpContext.Connection.RemoteIpAddress.MapToIPv4().ToString();


            //if (!TryValidateModel(param))
            //{
            //    param._message = _localizer["The input is incorrect."];
            //    return BadRequest(param);
            //}

            try
            {
                //既にチケットがある場合は、データベースに存在するか確認しあれば中身チェック

                //ログインユーザの取得
                var acount = (from a in _context.Accounts
                              where a.Email.Equals(param.Email)
                              where a.TermAddr.Equals(param.TermAddr)
                              where a.RemoteAddr.Equals(param.RemoteAddr)
                              select a).FirstOrDefault();

                //データが取得できた場合 中身を確認する
                if (acount != null)
                {
                    //未確認アカウントの場合は削除
                    if (!acount.EmailConfirmed)
                    {
                        _context.Accounts.Remove(acount);
                        _context.SaveChanges();
                    }
                    else
                    {
                        param._message = _localizer["Account has already been registered."];;
                        return(BadRequest(param));
                    }

                    ////期限をチェック
                    ////前のユーザを破棄して、再発行する
                    //_context.Accounts.Remove(acount);
                    //_context.SaveChanges();
                    //
                }

                // チケットがない場合
                var account = new Account();
                try
                {
                    ReflectionUtility.Model2Model(param, account);

                    account.AccountId        = Guid.NewGuid().ToString();
                    account.UserName         = account.UserName ?? account.Email.Split("@")[0];
                    account.EmailConfirmeKey = Guid.NewGuid().ToString();
                    account.Owner            = HttpContext.User.Identity.Name ?? param.UserName;
                    account.Registed         = DateTime.Now;
                    account.Updated          = DateTime.Now;
                    account.Version          = 1;

                    //登録
                    _context.Accounts.Add(account);
                    _context.SaveChanges();

                    //発行
                    var ticket = CreateJwtSecurityToken(account);
                    account.Ticket = new JwtSecurityTokenHandler().WriteToken(ticket);
                    _context.Accounts.Update(account);
                    _context.SaveChanges();
                    //認証済みということで返却
                    ReflectionUtility.Model2Model(account, param);
                }
                catch (Exception ex)
                {
                    param._message = _localizer["System error Please inform system personnel.({0})", ex.Message];
                    return(BadRequest(param));
                }

                try
                {
                    var callbackUrl = HttpContext.Request.Scheme + "://" + HttpContext.Request.Host + "/api/auth/confirm/" + account.EmailConfirmeKey;

                    //本人確認メール送信
                    var mail = new MailCreate();
                    mail.FromEmail = "*****@*****.**";
                    mail.ToEmail   = param.Email;
                    mail.Sender    = _localizer["システム管理者"];
                    mail.Subject   = _localizer["本人確認メールです。"];
                    mail.Body      = _localizer["If you use the system please click this URL. {0} ", callbackUrl];

                    if (SendMail(mail))
                    {
                        param._message = _localizer["We sent a person confirmation mail. Please SignIn after approval"];
                    }
                    else
                    {
                        param._message = _localizer["Please check that the specified mail is correct."];
                    };

                    return(Ok(param));
                }
                catch (Exception ex)
                {
                    param._message = _localizer["System error Please inform system personnel.({0})", ex.Message];
                    return(BadRequest(param));
                }
            }
            catch (Exception ex)
            {
                param._message = _localizer["System error Please inform system personnel.({0})", ex.Message];
                return(BadRequest(param));
            }
        }
 public async Task <IActionResult> SignUp([FromBody] SignUp command)
 => await DispatchAsync(command.BindId(c => c.Id));
示例#20
0
        public void signUp(Sitter model)
        {
            ISignUp dao = new SignUp();

            dao.sitterSignUp(model);
        }
示例#21
0
 public SignUpWorkflow(IWebDriver driver, ExtentTest test) : base(driver, test)
 {
     signUP = new SignUp(Driver);
     hummClient = new HummClient();
     login = new Login(Driver);
 }
示例#22
0
        public string HashPassword(Client user, SignUp data)

        {
            return(new PasswordHasher <Client>().HashPassword(user, data.Password));
        }
示例#23
0
 private void Start()
 {
     signUp = new SignUp();
     signUp.onCredentialsOperationFailed  += ActivateErrorMessage;
     signUp.onCredentialsOperationSucceed += ActivateSuccessMessage;
 }
示例#24
0
 virtual public void joinFlat(User user, SignUp view, string id, Building apartment, int flatNumber)
 {
 }
示例#25
0
        private void button2_Click(object sender, EventArgs e)
        {
            SignUp si = new SignUp();

            si.Show();
        }
        public ActionResult SignUp(string firstName, string lastName, string emailAddress)
        {
            if (string.IsNullOrEmpty(firstName) || string.IsNullOrEmpty(lastName) || string.IsNullOrEmpty(emailAddress))
            {
                return(View("~/Views/Shared/Error.cshtml"));
            }
            else
            {
                using (NewsletterEntities2 db = new NewsletterEntities2())
                {
                    var signup = new SignUp();
                    signup.FirstName    = firstName;
                    signup.LastName     = lastName;
                    signup.EmailAddress = emailAddress;

                    db.SignUps.Add(signup);
                    db.SaveChanges();
                }
                // Code used before switching to EntityFramework
                //string queryString = @"INSERT INTO SIgnUps (FirstName, LastName, EmailAddress) VALUES
                //                    (@FirstName, @LastName, @EmailAddress)";

                //using (SqlConnection connection = new SqlConnection(connectionString))
                //{
                //    SqlCommand command = new SqlCommand(queryString, connection);
                //    command.Parameters.Add("@FirstName", SqlDbType.VarChar);
                //    command.Parameters.Add("@LastName", SqlDbType.VarChar);
                //    command.Parameters.Add("@EmailAddress", SqlDbType.VarChar);

                //    command.Parameters["@FirstName"].Value = firstName;
                //    command.Parameters["@LastName"].Value = lastName;
                //    command.Parameters["@EmailAddress"].Value = emailAddress;

                //    connection.Open();
                //    command.ExecuteNonQuery();
                //    connection.Close();
                //}
                return(View("Success"));
            }


            //Code written to query Data before switched to EntityFramework
            //string queryString = @"SELECT Id, FirstName, LastName, EmailAddress, SocialSecurityNumber from Signups";
            //List<NewsletterSignUp> signups = new List<NewsletterSignUp>();

            //using (SqlConnection connection = new SqlConnection(connectionString))
            //{
            //    SqlCommand command = new SqlCommand(queryString, connection);

            //    connection.Open();

            //    SqlDataReader reader = command.ExecuteReader();

            //    while (reader.Read())
            //    {
            //        var signup = new NewsletterSignUp();
            //        signup.Id = Convert.ToInt32(reader["Id"]);
            //        signup.FirstName = reader["FirstName"].ToString();
            //        signup.LastName = reader["LastName"].ToString();
            //        signup.EmailAddress = reader["EmailAddress"].ToString();
            //        signup.SocialSecurityNumber = reader["SocialSecurityNumber"].ToString();
            //        signups.Add(signup);
            //    }
            //}
        }
示例#27
0
        async void Button_Clicked(System.Object sender, System.EventArgs e)
        {
            if (ValidateEntries())
            {
                var signUpClient = new SignUp();

                signUpClient.first_name                = firstName.Text;
                signUpClient.last_name                 = lastName.Text;
                signUpClient.business_uid              = "";
                signUpClient.driver_hours              = "";
                signUpClient.street                    = address.Text;
                signUpClient.city                      = city.Text;
                signUpClient.state                     = state.Text;
                signUpClient.zipcode                   = zipcode.Text;
                signUpClient.email                     = email.Text;
                signUpClient.phone                     = phoneNumber.Text;
                signUpClient.ssn                       = ssNumber.Text;
                signUpClient.license_num               = driverLicense.Text;
                signUpClient.license_exp               = "2021-06-01";
                signUpClient.driver_insurance_carrier  = insuranceCarrier.Text;
                signUpClient.driver_insurance_num      = insuranceNumber.Text;
                signUpClient.driver_insurance_exp_date = "2021-06-01";
                signUpClient.contact_name              = emergencyAddress.Text;
                signUpClient.contact_phone             = emergencyPhone.Text;
                signUpClient.contact_relation          = emergencyRelationship.Text;
                signUpClient.bank_acc_info             = accountNumber.Text;
                signUpClient.bank_routing_info         = routingNumber.Text;

                if (userToSignUp.platform == "DIRECT")
                {
                    signUpClient.password             = password1.Text;
                    signUpClient.social               = "NULL";
                    signUpClient.social_id            = "NULL";
                    signUpClient.mobile_access_token  = "FALSE";
                    signUpClient.mobile_refresh_token = "FALSE";
                    signUpClient.user_access_token    = "FALSE";
                    signUpClient.user_refresh_token   = "FALSE";
                }
                else
                {
                    signUpClient.password             = "";
                    signUpClient.mobile_access_token  = "FALSE";
                    signUpClient.mobile_refresh_token = "FALSE";
                    signUpClient.social             = userToSignUp.platform;
                    signUpClient.user_access_token  = userToSignUp.accessToken;;
                    signUpClient.user_refresh_token = userToSignUp.refreshToken;
                    signUpClient.social_id          = userToSignUp.socialID;
                }

                //SignUpUser(signUpClient);

                //user = new User();
                //user.id = "930-000027";
                //user.email = "";
                //user.socialId = "";
                //user.platform = "";
                //user.route_id = "";
                //SaveUser(user);
                data = JsonConvert.SerializeObject(user);

                _ = Navigation.PushAsync(new SubmitSignUpPage(), false);
            }
            else
            {
                await DisplayAlert("Oops", "Please fill in all entries before submitting your application.", "OK");
            }
        }
示例#28
0
        /// <param name='brand'>
        /// Required.
        /// </param>
        /// <param name='model'>
        /// Required.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        public async Task <HttpOperationResponse <string> > CreateSignUpsWithOperationResponseAsync(string brand, SignUp model, CancellationToken cancellationToken = default(System.Threading.CancellationToken))
        {
            // Validate
            if (brand == null)
            {
                throw new ArgumentNullException("brand");
            }
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            // Tracing
            bool   shouldTrace  = ServiceClientTracing.IsEnabled;
            string invocationId = null;

            if (shouldTrace)
            {
                invocationId = ServiceClientTracing.NextInvocationId.ToString();
                Dictionary <string, object> tracingParameters = new Dictionary <string, object>();
                tracingParameters.Add("brand", brand);
                tracingParameters.Add("model", model);
                ServiceClientTracing.Enter(invocationId, this, "CreateSignUpsAsync", tracingParameters);
            }

            // Construct URL
            string url = "";

            url = url + "/brands/";
            url = url + Uri.EscapeDataString(brand);
            url = url + "/signups";
            string baseUrl = this.Client.BaseUri.AbsoluteUri;

            // Trim '/' character from the end of baseUrl and beginning of url.
            if (baseUrl[baseUrl.Length - 1] == '/')
            {
                baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
            }
            if (url[0] == '/')
            {
                url = url.Substring(1);
            }
            url = baseUrl + "/" + url;
            url = url.Replace(" ", "%20");

            // Create HTTP transport objects
            HttpRequestMessage httpRequest = new HttpRequestMessage();

            httpRequest.Method     = HttpMethod.Post;
            httpRequest.RequestUri = new Uri(url);

            // Set Headers

            // Set Credentials
            if (this.Client.Credentials != null)
            {
                cancellationToken.ThrowIfCancellationRequested();
                await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);
            }

            // Serialize Request
            string requestContent = null;
            JToken requestDoc     = model.SerializeJson(null);

            requestContent      = requestDoc.ToString(Newtonsoft.Json.Formatting.Indented);
            httpRequest.Content = new StringContent(requestContent, Encoding.UTF8);
            httpRequest.Content.Headers.ContentType = MediaTypeHeaderValue.Parse("application/json");

            // Send Request
            if (shouldTrace)
            {
                ServiceClientTracing.SendRequest(invocationId, httpRequest);
            }
            cancellationToken.ThrowIfCancellationRequested();
            HttpResponseMessage httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);

            if (shouldTrace)
            {
                ServiceClientTracing.ReceiveResponse(invocationId, httpResponse);
            }
            HttpStatusCode statusCode = httpResponse.StatusCode;

            cancellationToken.ThrowIfCancellationRequested();
            string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);

            if (statusCode != HttpStatusCode.OK)
            {
                HttpOperationException <object> ex = new HttpOperationException <object>();
                ex.Request  = httpRequest;
                ex.Response = httpResponse;
                ex.Body     = null;
                if (shouldTrace)
                {
                    ServiceClientTracing.Error(invocationId, ex);
                }
                throw ex;
            }

            // Create Result
            HttpOperationResponse <string> result = new HttpOperationResponse <string>();

            result.Request  = httpRequest;
            result.Response = httpResponse;

            // Deserialize Response
            if (statusCode == HttpStatusCode.OK)
            {
                string resultModel = default(string);
                JToken responseDoc = null;
                if (string.IsNullOrEmpty(responseContent) == false)
                {
                    responseDoc = JToken.Parse(responseContent);
                }
                if (responseDoc != null)
                {
                    resultModel = responseDoc.ToString(Newtonsoft.Json.Formatting.Indented);
                }
                result.Body = resultModel;
            }

            if (shouldTrace)
            {
                ServiceClientTracing.Exit(invocationId, result);
            }
            return(result);
        }
示例#29
0
        public async Task <IActionResult> SignUp(SignUp signUp)
        {
            var result = await userService.CreateUser(signUp.Email, signUp.FullName, signUp.Password);

            return(this.FromResult(result));
        }
示例#30
0
    public async Task SignUpAsync(SignUp command, CancellationToken cancellationToken)
    {
        var user = await _userRepository.FindByEmailAsync(command.Email, cancellationToken);

        if (user is { })
示例#31
0
        async void Continue(System.Object sender, System.EventArgs e)
        {
            if (ValidateEntries())
            {
                if (userToSignUp.platform == "DIRECT")
                {
                    if (!ValidatePassword())
                    {
                        await DisplayAlert("Oops!", "Please enter a password and make sure they match.", "OK");

                        return;
                    }
                }

                var account = new SignUp();
                account.first_name                = firstName.Text.Trim();
                account.last_name                 = lastName.Text.Trim();
                account.business_uid              = "";
                account.driver_hours              = "";
                account.street                    = address.Text.Trim();
                account.unit                      = unit.Text == null ? "" : unit.Text;
                account.city                      = city.Text.Trim();
                account.state                     = state.Text.Trim();
                account.email                     = email.Text.Trim();
                account.zipcode                   = zipcode.Text.Trim();
                account.phone                     = phoneNumber.Text.Trim();
                account.ssn                       = ssNumber.Text.Trim();
                account.license_num               = driveLicenseNumber.Text.Trim();
                account.license_exp               = licenseExpDate.Trim();
                account.driver_car_year           = carYear.Text.Trim();
                account.driver_car_model          = carModel.Text.Trim();
                account.driver_car_make           = carMake.Text.Trim();
                account.driver_insurance_carrier  = insuranceCarrier.Text.Trim();
                account.driver_insurance_num      = insuranceNumber.Text.Trim();
                account.driver_insurance_exp_date = insuraceExpDate.Trim();
                account.contact_name              = emergencyFirstName.Text.Trim() + " " + emergencyLastName.Text;
                account.contact_phone             = emergencyPhoneNumber.Text.Trim();
                account.contact_relation          = emergencyRelationship.Text.Trim();
                account.bank_acc_info             = accountNumber.Text.Trim();
                account.bank_routing_info         = routingNumber.Text.Trim();
                account.latitude                  = addressToValidate.Latitude.ToString();
                account.longitude                 = addressToValidate.Longitude.ToString();
                account.referral_source           = GetDeviceInformation() + GetAppVersion();

                if (userToSignUp.platform == "DIRECT")
                {
                    account.password             = password1.Text.Trim();
                    account.mobile_access_token  = "FALSE";
                    account.mobile_refresh_token = "FALSE";
                    account.user_access_token    = "FALSE";
                    account.user_refresh_token   = "FALSE";
                    account.social    = "NULL";
                    account.social_id = "NULL";
                }
                else
                {
                    account.password             = "";
                    account.mobile_access_token  = userToSignUp.accessToken;
                    account.mobile_refresh_token = userToSignUp.refreshToken;
                    account.user_access_token    = "FALSE";
                    account.user_refresh_token   = "FALSE";
                    account.social    = userToSignUp.platform;
                    account.social_id = userToSignUp.socialID;
                }
                accountString = JsonConvert.SerializeObject(account);
                Debug.WriteLine("ACCOUNT: " + accountString);
                _ = Navigation.PushAsync(new SubmitSignUpPage(), false);
            }
            else
            {
                await DisplayAlert("Oops!", "Please check that you have filled all the entries in the application. In addition, don't forget to select an organization and take a picture of your insurance card. Thanks!", "OK");
            }
            //Navigation.PushAsync(new SubmitSignUpPage(), false);
        }
示例#32
0
        private SignUp CreateSignupEvent(RegisterViewModel model)
        {
            var signupAddress = new AddressDetails
            {
                FirstName = model.User.FirstName,
                LastName = model.User.LastName,
                PhoneNumber = model.User.Phone,
                Street1 = model.Address.Address1,
                Street2 = model.Address.Address2,
                City = model.Address.City,
                State = model.Address.State,
                ZipCode = model.Address.ZipCode,
                Country = model.Address.CountryRegion
            };

            var signupUser = new SignupUser
            {
                CreationDate = DateTimeOffset.Now,
                UpdateDate = DateTimeOffset.Now,
                FirstName = model.User.FirstName,
                LastName = model.User.LastName,
                Country = model.Address.CountryRegion,
                ZipCode = model.Address.ZipCode,
                TimeZone = new TimeSpan(0, 0, -model.DeviceFingerPrinting.ClientTimeZone, 0).ToString(),
                Language = "EN-US",
                PhoneNumber = model.User.Phone,
                Email = model.User.Email,
                ProfileType = UserProfileType.Consumer.ToString(),
                Address = signupAddress
            };

            var deviceContext = new DeviceContext
            {
                DeviceContextId = _contextAccessor.GetSessionId(),
                IPAddress = _contextAccessor.HttpContext.Connection.RemoteIpAddress.ToString(),
                Provider = DeviceContextProvider.DFPFingerPrinting.ToString(),
            };

            var marketingContext = new MarketingContext
            {
                Type = MarketingType.Direct.ToString(),
                IncentiveType = MarketingIncentiveType.None.ToString(),
                IncentiveOffer = "Integrate with Fraud Protection"
            };

            var storefrontContext = new StoreFrontContext
            {
                StoreName = "Fraud Protection Sample Site",
                Type = StorefrontType.Web.ToString(),
                Market = "US"
            };

            var signupEvent = new SignUp
            {
                SignUpId = Guid.NewGuid().ToString(),
                AssessmentType = AssessmentType.Protect.ToString(),
                User = signupUser,
                MerchantLocalDate = DateTimeOffset.Now,
                CustomerLocalDate = model.DeviceFingerPrinting.ClientDate,
                MarketingContext = marketingContext,
                StoreFrontContext = storefrontContext,
                DeviceContext = deviceContext,
            };
            return signupEvent;
        }
        public async Task <IActionResult> SignUp(SignUp command)
        {
            await _identityService.SignUpAsync(command.Id, command.Email, command.Password, command.Role);

            return(NoContent());
        }
示例#34
0
        public override void createBuilding(Building building, SignUp view, User user, int adminFlat)
        {
            connection.Open();
            SqlCommand insertCommand = new SqlCommand(insertStoredProcedure, connection);

            insertCommand.CommandType = System.Data.CommandType.StoredProcedure;

            insertCommand.Parameters.Add(new SqlParameter("@apartmentName", building.getAppartmentName()));
            insertCommand.Parameters.Add(new SqlParameter("@numberOfFloors", building.getNoOfFloors()));
            insertCommand.Parameters.Add(new SqlParameter("@flatsPerFloor", building.getFlatsPerFloor()));
            insertCommand.Parameters.Add(new SqlParameter("@code", building.getCode()));
            insertCommand.Parameters.Add(new SqlParameter("@balance", building.getBalance()));
            insertCommand.Parameters.Add(new SqlParameter("@adminID", Guid.Parse(user.getID())));

            SqlParameter returnedID = insertCommand.Parameters.Add(new SqlParameter("@apartmentId", System.Data.SqlDbType.UniqueIdentifier, 0, "apartmentID"));

            returnedID.Direction = ParameterDirection.Output;

            // try
            //  {

            if (insertCommand.ExecuteNonQuery() > 0)                                       // returns number of rows affected
            {
                building.setID(insertCommand.Parameters["@apartmentId"].Value.ToString()); // retreiving output value
                user.setApartmentID(insertCommand.Parameters["@apartmentId"].Value.ToString());



                // setting flats
                for (int i = 0; i < building.getNoOfFloors(); i++)
                {
                    for (int j = 0; j < building.getFlatsPerFloor(); j++)
                    {
                        SqlCommand createFlats = new SqlCommand(createFlatsProcedure, connection);
                        createFlats.CommandType = CommandType.StoredProcedure;
                        createFlats.Parameters.Add(new SqlParameter("@flatNumber", building.getFlatAt(i, j).getFlatNumber()));
                        createFlats.Parameters.Add(new SqlParameter("@apartmentID", Guid.Parse(building.getID())));


                        if (i + 1 == adminFlat / 100 && j + 1 == adminFlat % 10)
                        {
                            building.getFlatAt(i, j).makeManager(3);
                            user.setFlat(building.getFlatAt(i, j));
                        }

                        createFlats.Parameters.Add(new SqlParameter("@isManager", building.getFlatAt(i, j).getIsManager()));  // 1 = not manager, // 2 = manager, 3 = admi,


                        createFlats.ExecuteNonQuery();

                        createFlats.Dispose();
                    }
                }



                view.buildingCreated();
            }
            // }

            /* catch (Exception es)
             * {
             *   view.buildingFailed();
             * }
             */
        }
示例#35
0
        [ProducesResponseType(StatusCodes.Status400BadRequest)]                 // typeof(EmailInUseException)
        public async Task <IActionResult> SignUp([FromBody] SignUp command)
        {
            await _commandDispatcher.SendAsync(command);

            return(Accepted());
        }