Exemple #1
0
        public bool ResetUserPassword(string email, string password)
        {
            MatchBXNotification      objNotification = new MatchBXNotification();
            MatchBXNotificationModel objNotiMod      = new MatchBXNotificationModel();

            objUsersList = objUsersMod.GetList("*", " Email = '" + email + "' and IsActive=1");
            if (objUsersList.Count() > 0)
            {
                objUsers                     = objUsersList[0];
                objUsers.Password            = password;
                objNotification.ReceiverId   = objUsers.UserId;
                objNotification.SenderId     = objUsers.UserId;
                objNotification.ReadStatus   = 0;
                objNotification.Notification = "Your password has been reset ";
                objNotification.Header       = "Reset Password";
                int returnValue = objUsersMod.Save(objUsers);
                if (returnValue > 0)
                {
                    MatchBxCommon.sendResetPasswordAckEmail(objUsers, false);
                    int retstatus = objNotiMod.Save(objNotification);
                    TempData["ErrorMessage"] = "Your password has been reset successfully.";
                    return(true);
                }
                else
                {
                    TempData["ErrorMessage"] = "Password Reset Failed";
                    return(false);
                }
            }
            else
            {
                TempData["ErrorMessage"] = "The email is not registered for a Matchbx Account. Please try again";
                return(false);
            }
        }