Example #1
0
 public string PostSignupDetails(SignupDetails signupDetails)
 {
     try
     {
         var result = (from r in appDbContext.UserDefn where (r.UserName == signupDetails.UserName && r.MobileNumber == signupDetails.MobileNumber) select r).ToList();
         if (result.Count == 0)
         {
             var user = new UserDefn
             {
                 UserName     = signupDetails.UserName,
                 MobileNumber = signupDetails.MobileNumber,
                 Password     = signupDetails.Password,
                 EmailId      = signupDetails.EmailId,
                 RoleName     = "User"
             };
             appDbContext.UserDefn.Add(user);
             appDbContext.SaveChanges();
             return("Posted");
         }
         else
         {
             return("Failed");
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #2
0
 public void CompleteSignUp(SignupDetails signupDetails)
 {
     userName.SendKeys(signupDetails.UserName);
     email.SendKeys(signupDetails.Email);
     password.SendKeys(signupDetails.Password);
     signupButton.Click();
 }
    private void _Signup()
    {
        _CheckNameAvailability(LoginInput.text); //in case this is the last field updated by user and focus is not lost

        if (PasswordInput.text != null &&
            LoginInput.text != null &&
            EmailInput.text != null &&
            LoginErrorText.text == string.Empty &&
            PasswordErrorText.text == string.Empty)
        {
            var url           = ApiUrl + "/signup";
            var signupDetails = new SignupDetails
            {
                login = LoginInput.text,
                pwd   = PasswordInput.text,
                email = EmailInput.text
            };

            var jsonSignupDetails = JsonUtility.ToJson(signupDetails);

            var res = RestClient.Post(url, jsonSignupDetails);

            var result = JsonUtility.FromJson <SignupResult>(res);

            if (result != null)
            {
                ApplicationModel.PlayerName = result.login;
                ApplicationModel.PlayerId   = result.playerId;
                SceneManager.LoadScene("mainScene", LoadSceneMode.Single);
            }
        }
    }
Example #4
0
        public ApiResponseModel ChangePassword([FromForm] ChangePasswordModel changePasswordModel)
        {
            SignupDetails    signupDetails    = new SignupDetails();
            ApiResponseModel apiResponseModel = new ApiResponseModel();
            var loginData = HttpContext.Session.GetObjectFromJson <LoginOutputModel>("loginData");

            apiResponseModel.Message = signupDetails.ChangePassword(changePasswordModel, loginData);
            return(apiResponseModel);
        }
Example #5
0
        public void WhenICompleteTheSignUpForm()
        {
            homePage.OpenSignUpPage();
            SignupDetailsGenerator signupDetailsGenerator = new SignupDetailsGenerator();
            SignupDetails          signupDetails          = signupDetailsGenerator.Generate();

            signupPage.CompleteSignUp(signupDetails);
            ScenarioContext.Current["SignupDetails"] = signupDetails;
        }
Example #6
0
        public IActionResult SaveProfile([FromForm] UserProfileModel userProfileModel)
        {
            SignupDetails signupDetails = new SignupDetails();

            if (signupDetails.SaveProfile(userProfileModel, _env))
            {
                return(RedirectToAction("index", "Home"));
            }
            else
            {
                return(View());
            }
        }
Example #7
0
        public IActionResult RemoveResetPasswordLink([FromQuery] string txn)
        {
            SignupDetails signupDetails = new SignupDetails();

            if (signupDetails.RemoveResetLink(txn))
            {
                return(View());
            }
            else
            {
                TempData["Error"] = "Password reset link has been expired or invalid";
                return(View("ResetPassword"));
            }
        }
Example #8
0
        public IActionResult ResetPassword([FromForm] string Username)
        {
            SignupDetails signupDetails = new SignupDetails(_emailSender);
            var           data          = signupDetails.ResetPassword(Username);

            if (data != "sent")
            {
                TempData["Error"] = data;
            }
            else
            {
                TempData["success"] = "Please check your mail for further instructions.";
            }
            return(View());
        }
Example #9
0
        public IActionResult ValidatePasswordLink([FromQuery] string txn, [FromQuery] string user)
        {
            SignupDetails signupDetails = new SignupDetails();

            if (!signupDetails.ValidateResetLink(txn))
            {
                TempData["Error"] = "Password reset link has been expired or invalid";
                return(RedirectToAction("ResetPassword"));
            }
            else
            {
                TempData["txn"]      = txn;
                TempData["username"] = user;
                return(View("SetNewPassword"));
            }
        }
Example #10
0
        public IActionResult SetNewPassword([FromForm] SetPasswordModel setPasswordModel)
        {
            SignupDetails signupDetails = new SignupDetails();
            var           data          = signupDetails.SetNewPassword(setPasswordModel);

            if (data == "set")
            {
                TempData["success"] = "You have set your new password successfully.";
            }
            else
            {
                TempData["Error"]    = data;
                TempData["username"] = setPasswordModel.Username;
            }
            return(View());
        }
Example #11
0
 public bool Post([FromBody] SignupDetails add)
 {
     if (add != null)
     {
         var r = loginService.PostSignupDetails(add);
         if (r == "Posted")
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
        public IActionResult Signup([FromBody] SignupDetails signupDetails)
        {
            var user = new User
            {
                DisplayName = signupDetails.Username,
                Password    = "",
                TimeZone    = signupDetails.Timezone,
                UserName    = signupDetails.Username,
                Email       = signupDetails.Email
            };

            Db.Users.Add(user);
            Db.SaveChanges();

            var savedUser = Db.Users.FirstOrDefault(u => u.UserName.Equals(user.UserName));
            var activity  = new RecordedActivity(ActivityOperation.Create.ToString(), "Creates an entity", user, "", $"Created new user '{user.UserName}'", DateTimeOffset.UtcNow, savedUser.Id, EntityType.User);

            Db.RecordedActivities.Add(activity);
            Db.SaveChanges();
            return(null);
        }
Example #13
0
 public IActionResult SetNewPassword()
 {
     if (TempData["txn"] == null && TempData["username"] == null)
     {
         TempData["Error"] = "Invalid reset link. Please fallow the reset password again.";
         return(View("ResetPassword"));
     }
     else
     {
         SignupDetails signupDetails = new SignupDetails();
         if (!signupDetails.ValidateResetLink(TempData["txn"].ToString()))
         {
             TempData["Error"] = "Password reset link has been expired or invalid";
             return(View("ResetPassword"));
         }
         else
         {
             TempData["username"] = TempData["username"].ToString();
             return(View());
         }
     }
 }
Example #14
0
 public IActionResult SaveSignup(SignupModel signupModel)
 {
     if (ModelState.IsValid)
     {
         SignupDetails signupDetails = new SignupDetails();
         var           userdata      = signupDetails.SaveSignUp(signupModel);
         if (userdata.UserId > 0)
         {
             signupModel.UserId = userdata.UserId;
             HttpContext.Session.SetObjectAsJson("signupModel", signupModel);
             return(View("CompleteProfile", signupModel));
         }
         else
         {
             DropdownData dropdownData = new DropdownData();
             return(View("Signup", dropdownData.Get("usertype")));
         }
     }
     else
     {
         DropdownData dropdownData = new DropdownData();
         return(View("Signup", dropdownData.Get("usertype")));
     }
 }
Example #15
0
 /// <summary>
 /// Creates a new user
 /// </summary>
 /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
 /// <param name="signupDetails"> (optional)</param>
 /// <returns></returns>
 public void Signup(SignupDetails signupDetails = null)
 {
     SignupWithHttpInfo(signupDetails);
 }
Example #16
0
 /// <summary>
 /// Creates a new user
 /// </summary>
 /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
 /// <param name="signupDetails"> (optional)</param>
 /// <returns>Task of void</returns>
 public async System.Threading.Tasks.Task SignupAsync(SignupDetails signupDetails = null)
 {
     await SignupAsyncWithHttpInfo(signupDetails);
 }
Example #17
0
        public bool Isemailexist([FromQuery] string email)
        {
            SignupDetails signupDetails = new SignupDetails();

            return(signupDetails.IsEmailExist(email));
        }
Example #18
0
        public string VerifyEmail([FromBody] VerifyEmailModel verifyEmailModel)
        {
            SignupDetails signupDetails = new SignupDetails();

            return(signupDetails.VerifyEmail(verifyEmailModel));
        }
Example #19
0
        public string VerifyMobile([FromBody] VerifyMobileModel verifyMobileModel)
        {
            SignupDetails signupDetails = new SignupDetails();

            return(signupDetails.VerifyMobile(verifyMobileModel));
        }
Example #20
0
        /// <summary>
        /// Creates a new user
        /// </summary>
        /// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="signupDetails"> (optional)</param>
        /// <returns>Task of ApiResponse</returns>
        public async System.Threading.Tasks.Task <ApiResponse <Object> > SignupAsyncWithHttpInfo(SignupDetails signupDetails = null)
        {
            var    localVarPath         = "/api/Signup";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new List <KeyValuePair <String, String> >();
            var    localVarHeaderParams = new Dictionary <String, String>(this.Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json-patch+json",
                "application/json",
                "text/json",
                "application/_*+json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            if (signupDetails != null && signupDetails.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(signupDetails); // http body (model) parameter
            }
            else
            {
                localVarPostBody = signupDetails; // byte array
            }

            // authentication (Bearer) required
            if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization")))
            {
                localVarHeaderParams["Authorization"] = this.Configuration.GetApiKeyWithPrefix("Authorization");
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                                                                                                            Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                                            localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("Signup", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <Object>(localVarStatusCode,
                                            localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                            null));
        }
Example #21
0
 public ReceiversController(ApplicationDbContext context, IOptions <SignupDetails> signupDetails)
 {
     _context       = context;
     _signupDetails = signupDetails.Value ?? throw new ArgumentException(nameof(signupDetails));
 }