public void Send(string lookupValue, string languageCode, Action <ISendUsernameRecoveryResult> callback)
 {
     try
     {
         RecoverRequest recoverRequest = new RecoverRequest();
         recoverRequest.lookupValue = lookupValue;
         RecoverRequest request = recoverRequest;
         guestControllerClient.RecoverUsername(request, languageCode, delegate(GuestControllerResult <NotificationResponse> r)
         {
             if (!r.Success)
             {
                 callback(new SendUsernameRecoveryResult(success: false));
             }
             else
             {
                 ISendUsernameRecoveryResult recoverUsernameResult = GuestControllerErrorParser.GetRecoverUsernameResult(r.Response.error);
                 if (recoverUsernameResult != null)
                 {
                     callback(recoverUsernameResult);
                 }
                 else
                 {
                     callback(new SendUsernameRecoveryResult(r.Response.data != null));
                 }
             }
         });
     }
     catch (Exception ex)
     {
         logger.Critical("Unhandled exception: " + ex);
         callback(new SendUsernameRecoveryResult(success: false));
     }
 }
예제 #2
0
        public IHttpActionResult DoRecover([FromBody] RecoverRequest recoverRequest)
        {
            using (var responseMsg = new HttpResponseMessage())
            {
                IHttpActionResult result;

                try
                {
                    //Se o email enviado é null, retornar BadRequest
                    if (recoverRequest == null)
                    {
                        return(BadRequest("Dados inválidos."));
                    }

                    var userLogin = new UserLogin {
                        Email = recoverRequest.Email, UserType = recoverRequest.UserType
                    };

                    //Recupera o usuário de atendimento
                    var recoverResponse = _loginBusiness.DoRecover(userLogin);

                    //Monta response
                    result = Ok(Retorno <RecoverResponse> .Criar(true, "Recuperação de Senha Realizada Com Sucesso.", recoverResponse));

                    //Retorna o response com o token
                    return(result);
                }
                catch (Exception ex)
                {
                    return(InternalServerError(ex));
                }
            }
        }
예제 #3
0
        public Task <object> Recover(string phone)
        {
            var recoverRequest = new RecoverRequest();

            recoverRequest.AddParam("Phone", phone);
            return(ExecuteWithErrorHandling <object>(recoverRequest));
        }
        public void UpgradeNrt(RecoverRequest request, string languageCode, Action <GuestControllerResult <NotificationResponse> > callback)
        {
            QueueItem item = CreateQueueItem(AddLanguagePreference("/client/{client-id}/notification/upgrade-nrt", languageCode), HttpMethod.POST, request, GuestControllerAuthenticationType.ApiKey, callback);

            queue.Add(item);
            ExecuteNextCall();
        }
예제 #5
0
        public ActionResult Recover([FromBody] RecoverRequest req)
        {
            var rec = _context.RecoveryGrant.Where(r => r.Uid == req.Grant).FirstOrDefault <RecoveryGrant>();

            if (rec == null || rec.Code != req.Code)
            {
                return(BadRequest(new { message = "Invalid Grant or Code." }));
            }
            var user = _context.User.Where(u => u.Email == rec.Email).FirstOrDefault <User>();

            user.PasswordHash = _service.HashPassword(req.NewPassword);
            var recs = _context.RecoveryGrant.Where(r => r.DateSent < DateTime.Now.AddMinutes(5)).ToList();

            recs.Add(rec);
            _context.RecoveryGrant.RemoveRange(recs);
            _context.SaveChanges();
            return(Ok(new { message = "Success!" }));
        }
예제 #6
0
    // Use this for initialization
    void Start()
    {
        lifevalue    = 3;
        scores       = 0;
        Recover_time = 0;
        username     = Random.Range(1, 1000).ToString(); //随机名字
        UIIsdefeat.SetActive(false);
        syncActionRequest     = GetComponent <SyncActionRequest>();
        getinRequest          = GetComponent <GetinRequest>();
        getinRequest.username = username;
        Vector3    position = new Vector3(UnityEngine.Random.Range(-9, 10), UnityEngine.Random.Range(-7, 8), 0);
        GameObject play     = Instantiate(born, position, Quaternion.identity);

        play.GetComponent <Born>().Isplayer = true;
        getinRequest.pos       = position;
        getinRequest.direction = DirectiontCode.up;
        getinRequest.DefaultRequest();

        recoverRequest          = GetComponent <RecoverRequest>();
        recoverRequest.username = username;
    }