public AlunosBusiness(IConfiguration config)
        {
            _config = config;
            var createToken = new CreateToken(config);

            _token = createToken.CreateTokenProvisorio();
        }
示例#2
0
        private async Task <ActionResult> ObterProfileEmployeeInformationSME(BuscaPerfilServidor occupationsProfile, Perfil perfilSelecionado)
        {
            var createToken = new CreateToken(_config);
            var _token      = createToken.CreateTokenProvisorio();

            var abrangencia = await _AbrangenciaAPI.AbrangenciaCompactaSondagem(_token, occupationsProfile.codigoRF, perfilSelecionado.PerfilGuid);

            var retorno = new RetornoInfoPerfilDTO
            {
                DREs = abrangencia.Dres.Where(x => abrangencia.Ues.Any(z => z.CodigoDRE.Equals(x.CodigoDRE)))
                       .Select(x => new RetornoDREDTO
                {
                    Codigo = x.CodigoDRE,
                    Nome   = x.NomeDRE,
                    Sigla  = x.SiglaDRE
                }).ToHashSet(),
                CodigoServidor = occupationsProfile.codigoRF,
                Escolas        = abrangencia.Ues.Where(x => abrangencia.Turmas.Any(z => z.CodigoEscola.Equals(x.Codigo)))
                                 .Select(x => new RetornoEscolaDTO
                {
                    Sigla     = x.Sigla,
                    Codigo    = x.Codigo,
                    CodigoDRE = x.CodigoDRE,
                    Nome      = x.Nome
                }).ToHashSet()
            };

            return(Ok(retorno));
        }
示例#3
0
        public SondagemAutoralBusiness(IConfiguration config)
        {
            var createToken = new CreateToken(config);

            _token   = createToken.CreateTokenProvisorio();
            TurmaApi = new TurmasAPI(new EndpointsAPI());
        }
        public SondagemMatematicaTurma(IConfiguration config)
        {
            _config = config;
            var createToken = new CreateToken(config);

            _token = createToken.CreateTokenProvisorio();
        }
示例#5
0
        public IntegrationLoginResponse RequestIntegrationToken([FromBody] IntegrationLoginRequest request)
        {
            IntegrationLoginResponse response = new IntegrationLoginResponse();

            try
            {
                if (!string.IsNullOrEmpty(request.Key) && !string.IsNullOrEmpty(request.Source) && !string.IsNullOrEmpty(request.User))
                {
                    int tokenTimeout = Convert.ToInt32(_configuration["JWTTokenTimeout"]);

                    var result = _UserRepository.GetIntegrationLoginDetails(request.Key, request.User, request.Source);

                    if (result != null && result.Any())
                    {
                        var    curUser   = _UserRepository.GetUserDetails(result.First().UserName);
                        string userRoles = "";
                        int    i         = 0;

                        foreach (UserRoleDetails role in curUser.UserRoleDetails)
                        {
                            i++;
                            userRoles = userRoles + role.RoleName;

                            if (i != curUser.UserRoleDetails.Count)
                            {
                                userRoles = userRoles + ", ";
                            }
                        }
                        var token = CreateToken.GenerateToken(result.First().UserName, _configuration["SecurityKey"], _configuration["ValidIssuer"], _configuration["ValidAudience"], curUser.CompanyName, userRoles, tokenTimeout);
                        response.Token    = new JwtSecurityTokenHandler().WriteToken(token);
                        response.Expiry   = tokenTimeout.ToString();
                        response.UserInfo = result.FirstOrDefault();
                        response.Message  = "Success";

                        return(response);
                    }
                    else
                    {
                        response.Token   = null;
                        response.Expiry  = null;
                        response.Message = "Invalid Credentials";
                        return(response);
                    }
                }
                else
                {
                    response.Token   = null;
                    response.Expiry  = null;
                    response.Message = "UnAuthorized Request";
                    return(response);
                }
            }
            catch (Exception ex)
            {
                response.Token   = null;
                response.Expiry  = null;
                response.Message = ex.Message;
                return(response);
            }
        }
示例#6
0
        private Task <TokenOperationResult> CancelAndReplace(
            Token tokenToCancel,
            CreateToken tokenToCreate)
        {
            var signer  = cryptoEngine.CreateSigner(Level.Low);
            var request = new ReplaceTokenRequest
            {
                CancelToken = new CancelToken
                {
                    TokenId   = tokenToCancel.Id,
                    Signature = new Signature
                    {
                        MemberId   = MemberId,
                        KeyId      = signer.GetKeyId(),
                        Signature_ = signer.Sign(Stringify(tokenToCancel, TokenAction.Cancelled))
                    }
                },
                CreateToken = tokenToCreate
            };

            return(gateway(authenticationContext())
                   .ReplaceTokenAsync(request)
                   .ToTask(response =>
                           response.Result));
        }
        public async Task <JwtDto> RequestTokenAsync(CreateToken command)
        {
            var url      = urlBuilder.RequestToken();
            var response = await url.PostJsonAsync(command).ReceiveJson <JwtDto>();

            return(response);
        }
示例#8
0
        public LoginResponse RequestToken([FromBody] LoginRequest request)
        {
            LoginResponse response = new LoginResponse();

            try
            {
                if (!string.IsNullOrEmpty(request.UserName) && !string.IsNullOrEmpty(request.Password))
                {
                    int    tokenTimeout   = Convert.ToInt32(_configuration["JWTTokenTimeout"]);
                    string HashedPassword = Encrypt.Sha256encrypt(request.Password);
                    var    result         = _UserRepository.GetLoginDetails(request.UserName);
                    if (result.Count() > 0 && result.First().Password == HashedPassword)
                    {
                        var curUser = _UserRepository.GetUserDetails(request.UserName);
                        //string SA = _UserRepository.GetUserCompanyType(request.UserName);
                        string userRoles = "";
                        int    i         = 0;

                        foreach (UserRoleDetails role in curUser.UserRoleDetails)
                        {
                            i++;
                            userRoles = userRoles + role.RoleName;

                            if (i != curUser.UserRoleDetails.Count())
                            {
                                userRoles = userRoles + ", ";
                            }
                        }
                        var token = CreateToken.GenerateToken(request.UserName, _configuration["SecurityKey"], _configuration["ValidIssuer"], _configuration["ValidAudience"], curUser.CompanyName, userRoles, tokenTimeout);
                        response.Token   = new JwtSecurityTokenHandler().WriteToken(token);
                        response.Expiry  = tokenTimeout.ToString();
                        response.Message = "Success";

                        return(response);
                    }
                    else
                    {
                        response.Token   = null;
                        response.Expiry  = null;
                        response.Message = "Invalid Credentials";
                        return(response);
                    }
                }
                else
                {
                    response.Token   = null;
                    response.Expiry  = null;
                    response.Message = "UnAuthorized Request";
                    return(response);
                }
            }
            catch (Exception ex)
            {
                response.Token   = null;
                response.Expiry  = null;
                response.Message = ex.Message;
                return(response);
            }
        }
示例#9
0
        public async Task <IActionResult> Token([FromBody] CreateToken command)
        {
            logger.LogInformation("Request recevied for account/token");
            await DispatchAsync(command);

            var jwt = cache.GetJwt(command.UserId);

            return(Json(jwt));
        }
示例#10
0
        public async Task <string> AddTokenAsync(CreateToken body, TokenResultFormats?resultFormat, CancellationToken cancellationToken = default)
        {
            string response = await GetTokensUrl()
                              .WithHeader("Accept", s_tokenResultFormatsConverter.ConvertToString(resultFormat ?? TokenResultFormats.ApplicationJson))
                              .PostJsonAsync(body, cancellationToken)
                              .ReceiveString()
                              .ConfigureAwait(false);

            return(response);
        }
示例#11
0
        public async Task <ActionResult> AddUser([FromBody] User user)
        {
            var createToken = new CreateToken();

            user.Token = createToken.CreateNewToken();

            _context.Users.Add(user);
            await _context.SaveChangesAsync();

            return(Ok($"User with name \"{user.UserName}\" added"));
        }
    public static string CreateToken(string requestUrl, CreateToken createToken, out string errorMsg)
    {
        errorMsg = string.Empty;

        RequestDataResult requestDataResult = new RequestDataResult();

        string data          = JsonConvert.SerializeObject(createToken);
        string response_data = string.Empty;

        byte[] byteDataParams = UTF8Encoding.UTF8.GetBytes(data.ToString());

        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(requestUrl);

        request.Method        = "POST";
        request.ContentType   = "application/json";
        request.ContentLength = byteDataParams.Length;
        Stream stDataParams = request.GetRequestStream();

        stDataParams.Write(byteDataParams, 0, byteDataParams.Length);
        stDataParams.Close();

        try
        {
            HttpWebResponse webResponse    = (HttpWebResponse)request.GetResponse();
            Stream          webStream      = webResponse.GetResponseStream();
            StreamReader    responseReader = new StreamReader(webStream, System.Text.Encoding.UTF8);
            requestDataResult = JsonConvert.DeserializeObject <RequestDataResult>(responseReader.ReadToEnd());
            Console.Out.WriteLine(requestDataResult.Data);
            responseReader.Close();
        }
        catch (WebException e)
        {
            using (WebResponse response = e.Response)
            {
                HttpWebResponse httpResponse = (HttpWebResponse)response;

                using (Stream errorData = response.GetResponseStream())
                    using (StreamReader errorReader = new StreamReader(errorData))
                    {
                        string errorText = errorReader.ReadToEnd();
                        Console.WriteLine("--------Error---------");
                        Console.WriteLine("Error code: {0}", httpResponse.StatusCode);
                        Console.WriteLine("Error Msg: {0}", errorText);

                        ErrorResult errorResult = JsonConvert.DeserializeObject <ErrorResult>(errorText);
                        errorMsg = errorResult.Error.Detail;
                    }
            }

            requestDataResult.Data = string.Empty;
        }

        return(requestDataResult.Data);
    }
示例#13
0
        /// <summary>
        /// Create a path interpolation along the given path
        /// </summary>
        /// <param name="id"></param>
        /// <param name="duration"></param>
        /// <param name="ease"></param>
        /// <param name="path"></param>
        public PathInterpolation(int id, float duration, EEasingFunction ease, CreateToken tokenFunc, params T[] path)
        {
            if (path.Length < 2)
            {
                throw new ArgumentException("Interpolation paths cannot be less than 2 steps");
            }

            _id                  = id;
            _duration            = duration;
            _ease                = ease;
            _path                = path;
            _createTokenFunction = tokenFunc;
        }
示例#14
0
        public IActionResult Login([FromBody] User login)
        {
            CreateToken token = new  CreateToken();
            var         log   = _userService.Login(login);

            if (log != null)
            {
                log.Token = token.GenerateJwtToken(log);
                _userService.UpdateUser(log);

                return(Ok(log));
            }
            else
            {
                return(NotFound());
            }
        }
示例#15
0
    protected void BtnPayBoxCancel_Click(object sender, EventArgs e)
    {
        CreateToken createToken = new CreateToken();

        createToken.PartnerAPIId  = PARTNER_API_ID;
        createToken.PartnerAPIKey = PARTNER_API_KEY;

        string        errMsg = string.Empty;
        StringBuilder sbHtml = new StringBuilder();

        //API 통신 토큰 생성
        string token = PayBoxModule.CreateToken(CREATE_TOKEN_URL, createToken, out errMsg);

        if (string.IsNullOrEmpty(token))
        {
            sbHtml.Append("<script>alert('" + errMsg + "'); self.close();</script>");
            Response.Write(sbHtml.ToString());

            return;
        }

        RequestCancelPayment requestCancelPayment = new RequestCancelPayment();

        requestCancelPayment.CancelType    = Convert.ToInt32(Cancel_Type.Text.Trim());
        requestCancelPayment.TransactionId = TransactionId.Text.Trim();
        requestCancelPayment.TransAmount   = Convert.ToDouble(TransAmount.Text.Trim());

        //결제 취소 통신
        ReeponseCancelPayment reeponseCancelPayment = PayBoxModule.CacenlPayment(CANCEL_PAYMENT_URL, token, requestCancelPayment, out errMsg);

        if (reeponseCancelPayment == null)
        {
            sbHtml.Append("<script>alert('" + errMsg + "'); self.close();</script>");
            Response.Write(sbHtml.ToString());

            return;
        }

        sbHtml.Append("<script>alert('" + string.Format("{0}/{1}/{2}/{3}/{4}", reeponseCancelPayment.Data.ResultCode
                                                        , reeponseCancelPayment.Data.ResultMessage
                                                        , reeponseCancelPayment.Data.ResultNMessage
                                                        , reeponseCancelPayment.Data.TransactionId
                                                        , reeponseCancelPayment.Data.CancelDataTime) + "');self.close();</script>");
        Response.Write(sbHtml.ToString());
    }
示例#16
0
        public User login(string account, string password)
        {
            User user = DB.Context.From <User>()
                        .Where(d => (d.Account == account && d.Password == password))
                        .ToFirst();

            if (user == null)
            {
                return(null);
            }
            user.Attach();
            user.ExpiryTime = DateTime.Now.AddHours(1);
            CreateToken tokenGeneral = new CreateToken();
            string      token        = tokenGeneral.create(user.Id, user.ExpiryTime);

            user.Token = token;
            DB.Context.Update <User>(user);
            return(user);
        }
 //calls method from confirmation email
 public ActionResult ConfirmEmail(string userID, string code)
 {
     //confirms user and unlocks account
     var userStore = new UserStore<IdentityUser>();
     UserManager<IdentityUser> manager = new UserManager<IdentityUser>(userStore);
     var user = manager.FindById(userID);
     CreateToken ct = new CreateToken();
     CreateTokenProvider(manager, EMAIL_CONFIRMATION);
     try
     {
         IdentityResult result = manager.ConfirmEmail(userID, code);
         if (result.Succeeded)
             ViewBag.Message = "You are now registered!";
     }
     catch
     {
         ViewBag.Message = "Validation attempt failed!";
     }
     return View();
 }
        public ActionResult ForgotPassword(string email)
        {
            //ensures valid input
            if (ModelState.IsValid)
            {
                CaptchaHelper captchaHelper   = new CaptchaHelper();
                string        captchaResponse = captchaHelper.CheckRecaptcha();
                ViewBag.CaptchaResponse = captchaResponse;

                //creates token to be sent to mail helper to allow password reset through email
                var userStore = new UserStore <IdentityUser>();
                UserManager <IdentityUser> manager = new UserManager <IdentityUser>(userStore);
                var         user = manager.FindByEmail(email);
                CreateToken ct   = new CreateToken();
                CreateTokenProvider(manager, PASSWORD_RESET);

                var code        = manager.GeneratePasswordResetToken(user.Id);
                var callbackUrl = Url.Action("ResetPassword", "Home",
                                             new { userId = user.Id, code = code },
                                             protocol: Request.Url.Scheme);

                //send callbackUrl to email helper
                MailHelper mailer  = new MailHelper();
                string     message = "Please reset your password by clicking <a href=\""
                                     + callbackUrl + "\">here</a>";
                string subject = "Please reset your password";
                try
                {
                    mailer.EmailFromArvixe(message, user.Email, subject);
                    ViewBag.FakeEmailMessage =
                        "You have been sent an email to finish reseting your password";
                }
                catch (System.Exception ex)
                {
                    ViewBag.FakeEmailMessage = ex.Message;
                }
            }
            return(View());
        }
示例#19
0
        public async Task RequestTokenIfNeededAsync()
        {
            if (String.IsNullOrEmpty(secureStorage.Token) || secureStorage.TokenExpiration < DateTime.Now)
            {
                var command = new CreateToken()
                {
                    Password = secureStorage.Password,
                    UserId   = secureStorage.UserId
                };
                try
                {
                    var jwtToken = await client.RequestTokenAsync(command);

                    secureStorage.Token           = jwtToken.Token;
                    secureStorage.TokenExpiration = jwtToken.Expires;
                    client.SetAuthToken(jwtToken.Token);
                }
                catch (Exception ex)
                {
                }
            }
        }
        //calls method from confirmation email
        public ActionResult ConfirmEmail(string userID, string code)
        {
            //confirms user and unlocks account
            var userStore = new UserStore <IdentityUser>();
            UserManager <IdentityUser> manager = new UserManager <IdentityUser>(userStore);
            var         user = manager.FindById(userID);
            CreateToken ct   = new CreateToken();

            CreateTokenProvider(manager, EMAIL_CONFIRMATION);
            try
            {
                IdentityResult result = manager.ConfirmEmail(userID, code);
                if (result.Succeeded)
                {
                    ViewBag.Message = "You are now registered!";
                }
            }
            catch
            {
                ViewBag.Message = "Validation attempt failed!";
            }
            return(View());
        }
        public ActionResult ResetPassword(string password, string passwordConfirm,
                                          string passwordToken, string userID)
        {
            //called from email link, receives token and allows user to change password
            var userStore = new UserStore <IdentityUser>();
            UserManager <IdentityUser> manager = new UserManager <IdentityUser>(userStore);
            var         user = manager.FindById(userID);
            CreateToken ct   = new CreateToken();

            CreateTokenProvider(manager, PASSWORD_RESET);

            IdentityResult result = manager.ResetPassword(userID, passwordToken, password);

            if (result.Succeeded)
            {
                ViewBag.Result = "The password has been reset.";
            }
            else
            {
                ViewBag.Result = "The password has not been reset.";
            }
            return(View());
        }
示例#22
0
        public string Token()
        {
            HttpCookie TokenCookie = Request.Cookies["token"];
            string     token       = "";

            if (TokenCookie == null || TokenCookie.Value == "")
            {
                Task.Run(() =>
                {
                    //Token parametreleri Api tarafında 1 günlük olarak alınır
                    CreateToken createToken = new CreateToken("API KEY");
                    HttpCookie cokieToken   = new HttpCookie("token", createToken.token.token);
                    cokieToken.Expires      = DateTime.UtcNow.AddDays(1);
                    Response.Cookies.Add(cokieToken);
                    token = createToken.token.token;
                }).Wait();
            }
            else
            {
                token = Request.Cookies["token"].Value.ToString();
            }

            return(token);
        }
        public PollMatematica(IConfiguration config)
        {
            var createToken = new CreateToken(config);

            _token = createToken.CreateTokenProvisorio();
        }
        public ActionResult Register(RegisteredUser newUser)
        {
            //when user registers in checks model requirements to ensure valid input
            if (ModelState.IsValid)
            {
                CaptchaHelper captchaHelper   = new CaptchaHelper();
                string        captchaResponse = captchaHelper.CheckRecaptcha();
                ViewBag.CaptchaResponse = captchaResponse;

                // add user to database, lock account until email confirmation
                var userStore = new UserStore <IdentityUser>();
                UserManager <IdentityUser> manager = new UserManager <IdentityUser>(userStore)
                {
                    //set account to lock after consecutive failed login attempts
                    UserLockoutEnabledByDefault          = true,
                    DefaultAccountLockoutTimeSpan        = new TimeSpan(0, 10, 0),
                    MaxFailedAccessAttemptsBeforeLockout = 3
                };

                var identityUser = new IdentityUser()
                {
                    UserName = newUser.UserName,
                    Email    = newUser.Email
                };
                IdentityResult result = manager.Create(identityUser, newUser.Password);

                if (result.Succeeded)
                {
                    samUserRegEntities context = new samUserRegEntities();
                    AspNetUser         user    = context.AspNetUsers
                                                 .Where(u => u.UserName == newUser.UserName).FirstOrDefault();
                    AspNetRole role = context.AspNetRoles
                                      .Where(r => r.Name == "registered").FirstOrDefault();

                    user.AspNetRoles.Add(role);
                    context.SaveChanges();

                    //creates token to be passed to mail helper to allow email confirmation
                    CreateToken ct = new CreateToken();
                    CreateTokenProvider(manager, EMAIL_CONFIRMATION);


                    var code        = manager.GenerateEmailConfirmationToken(identityUser.Id);
                    var callbackUrl = Url.Action("ConfirmEmail", "Home",
                                                 new { userId = identityUser.Id, code = code },
                                                 protocol: Request.Url.Scheme);
                    //send callbackURL to email helper
                    MailHelper mailer = new MailHelper();
                    string     email  = "Please confirm your account by clicking this link: <a href=\""
                                        + callbackUrl + "\">Confirm Registration</a>";
                    string subject = "Please confirm your email";
                    //try
                    //{
                    mailer.EmailFromArvixe(email, identityUser.Email, subject);
                    ViewBag.FakeConfirmation =
                        "An account confirmation has been sent to your email, please confirm before attempting to login";
                    //}
                    //catch (System.Exception ex)
                    //{
                    //    ViewBag.FakeConfirmation = ex.Message;
                    //}
                }
            }
            return(View());
        }
示例#25
0
        public PeriodoAbertura(IConfiguration config)
        {
            var createToken = new CreateToken(config);

            _token = createToken.CreateTokenProvisorio();
        }
        public PollPortuguese(IConfiguration config)
        {
            var createToken = new CreateToken(config);

            _token = createToken.CreateTokenProvisorio();
        }
示例#27
0
        public Profile(IConfiguration config)
        {
            var createToken = new CreateToken(config);

            _token = createToken.CreateTokenProvisorio();
        }
示例#28
0
 => IsValid = JwtIsValid(CreateToken(tokenData.ClaimsData, tokenData.AdditionaData));
示例#29
0
 public AuthController(IMapper mapper, IUserManager userManager)
 {
     this.mapper      = mapper;
     this.userManager = userManager;
     this.createToken = new CreateToken();
 }
        public ActionResult Register(RegisteredUser newUser)
        {
            //when user registers in checks model requirements to ensure valid input
            if (ModelState.IsValid)
            {
                CaptchaHelper captchaHelper = new CaptchaHelper();
                string captchaResponse = captchaHelper.CheckRecaptcha();
                ViewBag.CaptchaResponse = captchaResponse;

                // add user to database, lock account until email confirmation
                var userStore = new UserStore<IdentityUser>();
                UserManager<IdentityUser> manager = new UserManager<IdentityUser>(userStore)
                {
                    //set account to lock after consecutive failed login attempts
                    UserLockoutEnabledByDefault = true,
                    DefaultAccountLockoutTimeSpan = new TimeSpan(0, 10, 0),
                    MaxFailedAccessAttemptsBeforeLockout = 3
                };

                var identityUser = new IdentityUser()
                {
                    UserName = newUser.UserName,
                    Email = newUser.Email
                };
                IdentityResult result = manager.Create(identityUser, newUser.Password);

                if (result.Succeeded)
                {
                    samUserRegEntities context = new samUserRegEntities();
                    AspNetUser user = context.AspNetUsers
                        .Where(u => u.UserName == newUser.UserName).FirstOrDefault();
                    AspNetRole role = context.AspNetRoles
                        .Where(r => r.Name == "registered").FirstOrDefault();

                    user.AspNetRoles.Add(role);
                    context.SaveChanges();

                    //creates token to be passed to mail helper to allow email confirmation
                    CreateToken ct = new CreateToken();
                    CreateTokenProvider(manager, EMAIL_CONFIRMATION);

                    var code = manager.GenerateEmailConfirmationToken(identityUser.Id);
                    var callbackUrl = Url.Action("ConfirmEmail", "Home",
                                                    new { userId = identityUser.Id, code = code },
                                                        protocol: Request.Url.Scheme);
                    //send callbackURL to email helper
                    MailHelper mailer = new MailHelper();
                    string email = "Please confirm your account by clicking this link: <a href=\""
                                    + callbackUrl + "\">Confirm Registration</a>";
                    string subject = "Please confirm your email";
                    //try
                    //{
                        mailer.EmailFromArvixe(email, identityUser.Email, subject);
                        ViewBag.FakeConfirmation =
                            "An account confirmation has been sent to your email, please confirm before attempting to login";
                    //}
                    //catch (System.Exception ex)
                    //{
                    //    ViewBag.FakeConfirmation = ex.Message;
                    //}

                }
            }
            return View();
        }
        public ActionResult ResetPassword(string password, string passwordConfirm,
                                          string passwordToken, string userID)
        {
            //called from email link, receives token and allows user to change password
            var userStore = new UserStore<IdentityUser>();
            UserManager<IdentityUser> manager = new UserManager<IdentityUser>(userStore);
            var user = manager.FindById(userID);
            CreateToken ct = new CreateToken();
            CreateTokenProvider(manager, PASSWORD_RESET);

            IdentityResult result = manager.ResetPassword(userID, passwordToken, password);
            if (result.Succeeded)
                ViewBag.Result = "The password has been reset.";
            else
                ViewBag.Result = "The password has not been reset.";
            return View();
        }
        public ActionResult ForgotPassword(string email)
        {
            //ensures valid input
            if (ModelState.IsValid)
            {
                CaptchaHelper captchaHelper = new CaptchaHelper();
                string captchaResponse = captchaHelper.CheckRecaptcha();
                ViewBag.CaptchaResponse = captchaResponse;

                //creates token to be sent to mail helper to allow password reset through email
                var userStore = new UserStore<IdentityUser>();
                UserManager<IdentityUser> manager = new UserManager<IdentityUser>(userStore);
                var user = manager.FindByEmail(email);
                CreateToken ct = new CreateToken();
                CreateTokenProvider(manager, PASSWORD_RESET);

                var code = manager.GeneratePasswordResetToken(user.Id);
                var callbackUrl = Url.Action("ResetPassword", "Home",
                                             new { userId = user.Id, code = code },
                                             protocol: Request.Url.Scheme);

                //send callbackUrl to email helper
                MailHelper mailer = new MailHelper();
                string message = "Please reset your password by clicking <a href=\""
                                         + callbackUrl + "\">here</a>";
                string subject = "Please reset your password";
                try
                {
                    mailer.EmailFromArvixe(message, user.Email, subject);
                    ViewBag.FakeEmailMessage =
                        "You have been sent an email to finish reseting your password";
                }
                catch (System.Exception ex)
                {
                    ViewBag.FakeEmailMessage = ex.Message;
                }
            }
            return View();
        }