コード例 #1
0
 public static string ReturnSignupAttemptresult(Employee NewUser)
 {
     using (TechX_SolutionsDBEntities TE = new TechX_SolutionsDBEntities())
     {
         try
         {
             TE.Employees.Add(NewUser);
             TE.Configuration.ValidateOnSaveEnabled = true;
             TE.SaveChanges();
         }
         catch (DbEntityValidationException dbEx)
         {
             ExceptionLog.Logger(dbEx);
         }
     }
     return("Account created successfully. Please login to continue.");
 }
コード例 #2
0
        public static string ReturnForgotPasswordAttemptResult(string EmailID, string EmployeeId)
        {
            using (TechX_SolutionsDBEntities TE = new TechX_SolutionsDBEntities())
            {
                var account = TE.Employees.Where(a => a.Work_Email_ID == EmailID && a.Employee_ID == EmployeeId).FirstOrDefault();
                if (account != null)
                {
                    string resetCode = Guid.NewGuid().ToString();

                    account.ResetPasswordLink = resetCode;
                    TE.Configuration.ValidateOnSaveEnabled = false;
                    TE.SaveChanges();
                    return("Reset password link has been sent to your email id.");
                }
                else
                {
                    return("Account not found");
                }
            }
        }
コード例 #3
0
 public static string ReturnResetPasswordAttemptResult(PasswordReset model)
 {
     using (TechX_SolutionsDBEntities TE = new TechX_SolutionsDBEntities())
     {
         var user = TE.Employees.Where(u => u.ResetPasswordLink == model.ResetCode).FirstOrDefault();
         try
         {
             if (user != null)
             {
                 user.Password          = PasswordHash.Hasher(model.Password);
                 user.ResetPasswordLink = "";
                 TE.Configuration.ValidateOnSaveEnabled = false;
                 TE.SaveChanges();
                 return("Password has been updated!");
             }
         }
         catch (Exception Ex)
         {
             ExceptionLog.Logger(Ex);
         }
     }
     return("Something went wrong while updating password!");
 }
コード例 #4
0
        public ActionResult ForgotPassword(string EmailID, string employeeid)
        {
            string message = "";

            using (TechX_SolutionsDBEntities TE = new TechX_SolutionsDBEntities())
            {
                var account = TE.Employees.Where(a => a.Work_Email_ID == EmailID && a.Employee_ID == employeeid).FirstOrDefault();
                if (account != null)
                {
                    string resetCode = Guid.NewGuid().ToString();
                    SendVerificationLinkEmail("*****@*****.**", resetCode, "ResetPassword");
                    account.ResetPasswordLink = resetCode;
                    TE.Configuration.ValidateOnSaveEnabled = false;
                    TE.SaveChanges();
                    message = "Reset password link has been sent to your email id.";
                }
                else
                {
                    message = "Account not found";
                }
            }
            ViewBag.Message = message;
            return(View());
        }