예제 #1
0
        //
        // GET: /Account/Login
        public ActionResult SetupTwoFactorAuthentication()
        {
            string userId = User.Identity.GetUserId();

            if (!string.IsNullOrEmpty(userId))
            {
                RedirectToAction("Index", "Home");
            }

            var user = _userManager.FindById(userId);

            if (user.TwoFactorEnabled)
            {
                RedirectToAction("Index", "Home");
            }

            TwoFactorAuthenticator TwoFacAuth = new TwoFactorAuthenticator();

            var email = EncryptionService.DecryptEmail(user.Email);

            string UserUniqueKey = (email + EwiPracaConstants.GoogleKeys.TwoFactorAuthenticatorKey);

            Session["UserUniqueKey"] = UserUniqueKey;

            var setupInfo = TwoFacAuth.GenerateSetupCode("EwiPraca", email, UserUniqueKey, 300, 300);

            ViewBag.BarcodeImageUrl = setupInfo.QrCodeSetupImageUrl;
            ViewBag.SetupCode       = setupInfo.ManualEntryKey;

            return(View());
        }
예제 #2
0
        private EmailMessage CreateCustomEventReminderMessage(CustomEvent customEvent)
        {
            var applicationUser = customEvent.Company.ApplicationUser;

            EmailMessage message = new EmailMessage()
            {
                EmailType         = Enumerations.EmailType.CustomEventReminder,
                ApplicationUserID = applicationUser.Id,
                Recipient         = EncryptionService.DecryptEmail(applicationUser.Email),
                Body    = string.Format(WebResources.CustomEventReminderMessageBody, customEvent.Title),
                Subject = "Przypomnienie o nadchodzącym zdarzeniu z Twojego kalendarza"
            };

            _emailMessageService.Create(message);

            return(message);
        }
예제 #3
0
        private EmailMessage CreateLeaveReminderMessage(Leave leave)
        {
            var applicationUser = leave.Employee.UserCompany.ApplicationUser;

            EmailMessage message = new EmailMessage()
            {
                EmailType         = Enumerations.EmailType.OSHTrainingExpiredReminder,
                EmployeeId        = leave.EmployeeId,
                ApplicationUserID = applicationUser.Id,
                Recipient         = EncryptionService.DecryptEmail(applicationUser.Email),
                Body    = string.Format(WebResources.LeaveReminderMessageBody, string.Format("{0} {1}", leave.Employee.FirstName, leave.Employee.Surname), leave.DateFrom.ToShortDateString(), leave.DateTo.ToShortTimeString()),
                Subject = "Przypomnienie o nadchodzącym urlopie Twojego pracownika"
            };

            _emailMessageService.Create(message);

            return(message);
        }
예제 #4
0
        private EmailMessage CreateOSHTrainingReminderMessage(OSHTraining oshTrainingToExpire)
        {
            var applicationUser = oshTrainingToExpire.Employee.UserCompany.ApplicationUser;

            EmailMessage message = new EmailMessage()
            {
                EmailType         = Enumerations.EmailType.OSHTrainingExpiredReminder,
                EmployeeId        = oshTrainingToExpire.EmployeeId,
                ApplicationUserID = applicationUser.Id,
                Recipient         = EncryptionService.DecryptEmail(applicationUser.Email),
                Body    = WebResources.OSHTrainingToExpireReminderEmailBody,
                Subject = WebResources.OSHTrainingToExpireReminderEmailTitle
            };

            _emailMessageService.Create(message);

            return(message);
        }