예제 #1
0
        //User Forgot Password - loginId
        public void ForgotPassword(string loginId)
        {
            try
            {
                var vList = GetUserByLoginId(loginId);
                if (vList == null)
                {
                    throw new UserNotFoundException("User Not Found");
                }

                string strToken_No = tokenService.GenerateToken();
                string strLink     = PasswordResetLink + "Login_Id=" + vList.Login_Id + "&Token_No=" + strToken_No;
                userPasswordResetRepository.Insert(vList.User_Id, strLink, strToken_No);

                #region Sent link to User

                Common.Email vEmailConfiguration = new Common.Email(adbContext);
                var          usermodel           = vEmailConfiguration.GetEmailBody(vList.Email, String.Empty, String.Empty, "Reset Password Link", "Please find below link for your reset password  " + strLink);
                vEmailConfiguration.SendEmail(usermodel, vEmailConfiguration.GetEmailConfiguration(vList.Company_Id));

                #endregion
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #2
0
        //User Forgot Password - loginId
        public void ForgotPassword(string loginId)
        {
            try
            {
                var vList = objUserService.GetUserByLoginId(loginId);
                if (vList != null)
                {
                    vList.Password           = objUser_PasswordRepo.GeneratePassword(EmailDefaultPassword);
                    vList.PasswordExpiryDate = DateTime.Now.AddDays(PasswordExpiryDays);
                    vList.UpdatedBy          = vList.User_Id;
                    vList.UpdatedOn          = DateTime.Now;

                    adbContext.users.Update(vList);
                    adbContext.SaveChanges();

                    PasswordResetLink += EncryptLink(vList.Login_Id);
                    Insert(vList.User_Id, PasswordResetLink);

                    //  remove and generate new token
                    objTokenService.Add(new User_Token {
                        User_Id = vList.User_Id
                    });

                    #region Sent link to User

                    Common.Email vEmailConfiguration = new Common.Email(adbContext);
                    var          usermodel           = vEmailConfiguration.GetEmailBody(vList.Email, "*****@*****.**", "", "Reset Password Link", "Please find below link for your reset password  " + PasswordResetLink);
                    vEmailConfiguration.SendEmail(usermodel, vEmailConfiguration.GetEmailConfiguration(vList.Company_Id));

                    #endregion
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }