Esempio n. 1
0
 public static bool Check(this RecoveryEmail data)
 {
     return(data.Trace != null &&
            data.Trace.Length >= 1 &&
            IsValidReportTime(data.ReportTime) &&
            IsValidUsername(data.Username) &&
            IsValidEmail(data.Email));
 }
Esempio n. 2
0
        public int Step2(string code)
        {
            if (CheckVendor.NotValidCode(code))
            {
                return(03_0011);
            }

            if (CheckVendor.NotValidResponse(_serverResponse))
            {
                return(02_0008);
            }

            if (_email == null)
            {
                return(00_0000);
            }

            var recoveryEmail = new RecoveryEmail();

            recoveryEmail.Username = _username;

            recoveryEmail.Email = _email;

            recoveryEmail.Trace = _trace;

            recoveryEmail.Code = code;

            recoveryEmail.ReportTime = DateTime.Now;

            var result = ApiCall.AccountRecoveryEmail.Call(null, new MilvanethProtocol {
                Context = null, Data = recoveryEmail
            });

            if (!(result.Data is ServerResponse sr))
            {
                return(02_0007);
            }

            if (!CheckVendor.NotValidResponse(sr))
            {
                _serverResponse = sr;
            }

            return(sr.Message);
        }
Esempio n. 3
0
 public ActionResult Recovery(RecoveryEmail model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             var minutes = _accessTokenService.ValidateWebEmailAndSendCode(model.Email);
             return(RedirectToAction("ChangePassword").WithSuccess("En kod har blivit sänd till din emailadress och den är giltig i några " + minutes + " minuter."));
         }
         else
         {
             return(View());
         }
     }
     catch (Exception ex)
     {
         _log.ErrorFormat("Error occured during email recovery. Error : {0}", ex.Message);
         _log.Error(ex);
         return(View().WithError(ex.Message));
     }
 }
Esempio n. 4
0
 public ActionResult Recovery(RecoveryEmail model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             var minutes = _accessTokenService.ValidateEmailAndSendCode(model.Email);
             return(RedirectToAction("ChangePassword").WithSuccess("Code has been sent to your email.It will expire in " + minutes + " minutes."));
         }
         else
         {
             return(View());
         }
     }
     catch (Exception ex)
     {
         _log.ErrorFormat("Error occured during email recovery. Error : {0}", ex.Message);
         _log.Error(ex);
         return(View().WithError(ex.Message));
     }
 }
Esempio n. 5
0
        public int Step1(string username, string email, long[] trace)
        {
            if (CheckVendor.NotValidUsername(username) ||
                CheckVendor.NotValidEmail(email) ||
                CheckVendor.NotValidTrace(trace))
            {
                return(03_0010);
            }

            _username = username;
            _email    = email;
            _trace    = trace;
            var recoveryEmail = new RecoveryEmail();

            recoveryEmail.Username = username;

            recoveryEmail.Email = email;

            recoveryEmail.Trace = trace;

            recoveryEmail.ReportTime = DateTime.Now;

            var result = ApiCall.AccountRecoveryEmail.Call(null, new MilvanethProtocol {
                Context = null, Data = recoveryEmail
            });

            if (!(result.Data is ServerResponse sr))
            {
                return(02_0007);
            }

            if (!CheckVendor.NotValidResponse(sr))
            {
                _serverResponse = sr;
            }

            return(sr.Message);
        }
Esempio n. 6
0
        //User login Table is removed now // Prakash will delete it later
        //public LoginDetail Login(FrayteLogin userCrednetial)
        //{
        //    var userResult = (from UL in dbContext.UserLogins
        //                      join UR in dbContext.UserRoles on UL.UserId equals UR.UserId
        //                      where UL.UserName == userCrednetial.UserName && UL.Password == userCrednetial.Password
        //                      select new
        //                      {
        //                          LastLogIn = UL.LastLoginDate,
        //                          RoleId = UR.RoleId,
        //                          UserId = UL.UserId
        //                      }).FirstOrDefault();

        //    if (userResult != null)
        //    {
        //        if (userResult.RoleId > 0 && userResult.RoleId != (int)FrayteUserRole.Customer)
        //        {
        //            var OperationZone = UtilityRepository.GetOperationZone();
        //            var result = (from ul in dbContext.UserLogins
        //                          join u in dbContext.Users on ul.UserId equals u.UserId
        //                          join ur in dbContext.UserRoles on ul.UserId equals ur.UserId
        //                          where
        //                               ul.UserName == userCrednetial.UserName &&
        //                               ul.Password == userCrednetial.Password &&
        //                               u.IsActive == true
        //                          select new LoginDetail()
        //                          {
        //                              EmployeeId = ul.UserId,
        //                              EmployeeName = u.ContactName,
        //                              EmployeeMail = u.Email,
        //                              EmployeeRoleId = ur.RoleId,
        //                              SessionId = "123456789",
        //                              IsLastLogin = userResult.LastLogIn.HasValue ? true : false,
        //                              PhotoUrl = ul.ProfileImage,
        //                              ValidDays = 0,
        //                              CustomerCurrency = "",
        //                              OperationZoneId = OperationZone.OperationZoneId,
        //                              OperationZoneName = OperationZone.OperationZoneName
        //                          }).FirstOrDefault();

        //            return result;
        //        }
        //        else
        //        {
        //            var MarginCost = dbContext.CustomerMarginCosts.Where(p => p.CustomerId == userResult.UserId).ToList();
        //            if (MarginCost != null && MarginCost.Count > 0)
        //            {
        //                var OperationZone = UtilityRepository.GetOperationZone();
        //                var result = (from ul in dbContext.UserLogins
        //                              join u in dbContext.Users on ul.UserId equals u.UserId
        //                              join ua in dbContext.UserAdditionals on u.UserId equals ua.UserId
        //                              join ur in dbContext.UserRoles on ul.UserId equals ur.UserId
        //                              where
        //                                   ul.UserName == userCrednetial.UserName &&
        //                                   ul.Password == userCrednetial.Password &&
        //                                   u.IsActive == true
        //                              select new LoginDetail()
        //                              {
        //                                  EmployeeId = ul.UserId,
        //                                  EmployeeName = u.ContactName,
        //                                  EmployeeMail = u.Email,
        //                                  EmployeeRoleId = ur.RoleId,
        //                                  SessionId = "123456789",
        //                                  IsLastLogin = userResult.LastLogIn.HasValue ? true : false,
        //                                  ValidDays = ua.DaysValidity.HasValue ? ua.DaysValidity.Value : 0,
        //                                  CustomerCurrency = ua.CreditLimitCurrencyCode,
        //                                  PhotoUrl = ul.ProfileImage,
        //                                  OperationZoneId = OperationZone.OperationZoneId,
        //                                  OperationZoneName = OperationZone.OperationZoneName,
        //                                  UserOperationZoneId = u.OperationZoneId
        //                              }).FirstOrDefault();

        //                if (OperationZone.OperationZoneId == result.UserOperationZoneId)
        //                {
        //                    return result;
        //                }
        //                else
        //                {
        //                    return null;
        //                }
        //            }
        //            else
        //            {
        //                return null;
        //            }
        //        }
        //    }
        //    else
        //    {
        //        return null;
        //    }
        //}

        public RecoveryEmail SendRecoveryEmail(RecoveryEmail recoveryEmail)
        {
            return(recoveryEmail);
        }
        public ChangePasswordEmailView()
        {
            InitializeComponent();

            Loaded += (sender, args) => RecoveryEmail.Focus();
        }
        ///define method

        ///recovery email process
        public void recoveryEmailProcess()
        {
            RecoveryEmail.SendKeys("*****@*****.**");
            searchButton.Click();
        }