Exemplo n.º 1
0
        public ActionResult RestPass(RecoverPass_VM recoverPass_VM)
        {
            if (recoverPass_VM.NewPassword == "" || recoverPass_VM.NewPassword == null)
            {
                return(View("Index"));
            }

            if (recoverPass_VM.NewPassword != recoverPass_VM.ConfirmedPassword)
            {
                ViewBag.ErrorMessage = "Please make shure Passowrds are matched";
                return(View("Index"));
            }
            else
            {
                // Update User Row With new password.
                string Email = EncryptDecryptString.Decrypt(Request.Url.Segments.Last(), "Taj$$Key");
                ResetPasswordService ResetService = new ResetPasswordService();
                var Model = new RegisterViewModel {
                    Email = Email, Password = EncryptDecryptString.Encrypt(recoverPass_VM.NewPassword, "Taj$$Key")
                };
                Model.IsActive = null; Model.Mobile = null; Model.Phone = null; Model.UserID = null; Model.Username = null;
                int Result = ResetService.Update(Model);
                if (Result < 0)
                {
                    ViewBag.ErrorMessage = _GlobalizationManager.GetTranslatedText("There is an Error while recovering your password", Enum_LangModule.MaskanWeb, "84");
                    return(View("Index"));
                }
                else
                {
                    ViewBag.ErrorMessage = _GlobalizationManager.GetTranslatedText("Your password successfully recovered, Please login with your new password.", Enum_LangModule.MaskanWeb, "83");
                    return(View("Index"));
                }
            }
        }
Exemplo n.º 2
0
    private void ShowUserInformation(int Id)
    {
        var result = new UsersManager().GetUsers(Id);

        if (result != null)
        {
            Email.Text          = result.Email;
            UserFullName.Text   = result.UserFullName;
            Phone.Text          = result.Phone;
            Mobile.Text         = result.Mobile;
            Nationality.Text    = result.Nationality;
            Username.Text       = result.Username;
            EmpID.Text          = result.EmpID;
            JobID.SelectedValue = string.Format("{0}", result.JobID);
            JoinDate.Text       = string.Format("{0:dd/MM/yyyy}", result.JoinDate);
            IsActive.Checked    = (bool)result.IsActive;
            Password.Text       = EncryptDecryptString.Decrypt(result.Password, "Taj$$Key");

            if (!string.IsNullOrEmpty(result.Sig))
            {
                sig.InnerHtml = result.Sig;
                clear.Visible = SaveSignature.Visible = false;
            }
        }
    }
Exemplo n.º 3
0
        public string RecoverPassoerd(string Email)
        {
            try
            {
                // check Email in our database or not.
                UserService _userService = new UserService();
                var         _paramters   = new LogInParams()
                {
                    Email = Email
                };

                List <UserViewModel> User_List = new List <UserViewModel>();
                User_List = _userService.Find(_paramters);
                if (User_List.Count <= 0)
                {
                    return("This email does not exsit in our database");
                }

                //---------------------------------------------------------------

                System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient();
                client.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
                client.EnableSsl      = true;
                client.Host           = "smtp.gmail.com";
                client.Port           = 587;

                string AppEmail = EncryptDecryptString.Decrypt(ConfigurationManager.AppSettings["Email"], "Taj$$Key");
                string AppPass  = EncryptDecryptString.Decrypt(ConfigurationManager.AppSettings["EmailAuth"], "Taj$$Key");

                System.Net.NetworkCredential credentials = new System.Net.NetworkCredential(AppEmail, AppPass);
                client.UseDefaultCredentials = false;
                client.Credentials           = credentials;

                System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();
                msg.From = new MailAddress(AppEmail);
                msg.To.Add(new MailAddress(Email));

                msg.Subject = "Maskan Rest Password";

                msg.IsBodyHtml = true;
                string _pass = EncryptDecryptString.Encrypt(Email, "Taj$$Key");

                string CurrentUrl = "http://" + Request.Url.DnsSafeHost + ":" + Request.Url.Port + "/ResetPassword/restpass/" + _pass;
                // Email Body.
                string body = "Dear User <br />";
                body += "Please fllow this link to recover your passord </br>";
                body += "<a href =" + CurrentUrl + "> Maskan rest your Password </ a >  <br />";

                msg.Body       = body;
                msg.IsBodyHtml = true;

                client.Send(msg);

                return("Success");
            }
            catch (Exception ex)
            {
                return(ex.Message);
            }
        }
Exemplo n.º 4
0
    public static void UserLogin(HttpCookie _userInfo)
    {
        string cookieIDVal       = EncryptDecryptString.Decrypt(_userInfo[Config.cookieID], Config.encrypptKey),
               cookieUsernameVal = HttpContext.Current.Server.UrlDecode(EncryptDecryptString.Decrypt(_userInfo[Config.cookieUsername], Config.encrypptKey)),
               cookieLevelVal    = EncryptDecryptString.Decrypt(_userInfo[Config.cookieLevel], Config.encrypptKey);

        SessionManager.Current.ID    = cookieIDVal;
        SessionManager.Current.Name  = cookieUsernameVal;
        SessionManager.Current.Level = cookieLevelVal;
    }
Exemplo n.º 5
0
        public HttpResponseMessage Register(UserViewModel model)
        {
            try
            {
                UserService _userService = new UserService();
                string      _pass        = EncryptDecryptString.Decrypt(model.Password, "Taj$$Key");
                var         _paramters   = new UserViewModel()
                {
                    Username     = model.Username,
                    UserFullName = model.Username,
                    Password     = _pass,
                    Email        = model.Email,
                    Phone        = model.Phone,
                    Address      = model.Address,
                    Country      = model.Country
                };
                _paramters.UserID    = null;
                _paramters.IsActive  = null;
                _paramters.IsDeleted = null;

                int Result = _userService.Insert(_paramters);

                if (Result == -1)
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, Result)); //User with this Email or Username Already Exists
                }
                if (Result <= 1)
                {
                    SessionHandler.Instance.Set(_paramters, SessionEnum.User_Info); // Save User Session.
                    return(Request.CreateResponse(HttpStatusCode.OK, Result));
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.InternalServerError));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
        public IActionResult SaveZipFiles(IEnumerable <ZipFileViewModel> model)
        {
            var repo     = new ZipFileRepo();
            var fileList = new List <ZipFileDetailDto>();
            var key      = configuration.GetSection("AppSettings").GetSection("EncKey").Value;

            foreach (var item in model)
            {
                fileList.Add(new ZipFileDetailDto {
                    FileName    = EncryptDecryptString.Decrypt(item.Name, key),
                    IsDerectory = item.IsFolder
                });
            }

            var fileHeader = new ZipFileHeaderDto()
            {
                FileName       = fileList[0].FileName,
                ZipFileDetails = fileList
            };

            repo.SaveFile(fileHeader);
            return(Ok());
        }
Exemplo n.º 7
0
 public static string decryptPassword(string value)
 {
     return(EncryptDecryptString.Decrypt(value, "Taj$$Key"));
 }
Exemplo n.º 8
0
    public static string decryptPassword(string value)
    {
        string _pass = EncryptDecryptString.Decrypt(value, "Taj$$Key");

        return(_pass);
    }