Exemplo n.º 1
0
        private void OnUpdateEmailVerify(Datagram datagram)
        {
            UpdateEmailVerify req = datagram.UnSerialData <UpdateEmailVerify>();

            UpdateEmailResponse response = new UpdateEmailResponse();

            if (EmailRequestCache.TryRemove(req.NextLabel, out EmailRequestPackage value))
            {
                if (InternalTools.VerificateCode(value.Verify, req.Verifies))
                {
                    Guid guid = Guid.NewGuid();
                    if (SQLDB.UpdateEmail(value.UserID, value.Email))
                    {
                        response.NextLabel = guid;
                    }
                }
            }

            datagram.DataType    = DatagramType.Client;
            datagram.MessageType = LoginMessageType.UpdateEmailResult;
            datagram.Datas       = response.ToByteArray();

            if (!Send(datagram.ToByteArray()))
            {
                Notify(IKXTServer.LogLevel.Error, "数据发送异常");
                Close();
            }
        }
Exemplo n.º 2
0
 static UpdateEmailResponse Process(SessionInfo session, UpdateEmailResponse res, string email)
 {
     if (res.Success)
     {
         session.Email = email;
     }
     return(res);
 }
Exemplo n.º 3
0
        private void OnLogin_UpdateEmailRes(Datagram datagram)
        {
            UpdateEmailResponse res = datagram.UnSerialData <UpdateEmailResponse>();

            if (RunningDatas.RequestTable.TryRemove(datagram.RequestID, out RequestSender value))
            {
                value.RequestCallback(res);
            }
        }
        public async Task <IActionResult> UpdateUserEmail(PostUpdateEmailRequest request)
        {
            string uid = User.GetUid();

            var user = await _fbService.UpdateUserEmailAsync(uid, request.Email);

            var resposne = new UpdateEmailResponse()
            {
                Email = user.Email
            };

            return(Ok(resposne));
        }
Exemplo n.º 5
0
        private void OnUpdateEmailReq(Datagram datagram)
        {
            UpdateEmailReq req = datagram.UnSerialData <UpdateEmailReq>();

            UpdateEmailResponse response = new UpdateEmailResponse();

            if (!SQLDB.CheckEmail(req.UserEmail))
            {
                if (SQLDB.SelectUserInfor(req.UserID, out UserInfoPackage info))
                {
                    Guid request_id = Guid.NewGuid();

                    byte[] ver_code = InternalTools.GenerateVerification();
                    if (EmailRequestCache.TryAdd(request_id, new EmailRequestPackage
                    {
                        UserID = info.ID,
                        Email = req.UserEmail,
                        Verify = ver_code,
                        Time = DateTime.Now
                    }))
                    {
                        if (
                            InternalTools.SendUpdateEmailVerificateEmail
                            (
                                req.UserEmail,
                                InternalTools.GenerateVerification(ver_code)
                            )
                            )
                        {
                            response.NextLabel = request_id;
                        }
                    }
                }
            }

            datagram.DataType    = DatagramType.Client;
            datagram.MessageType = LoginMessageType.UpdateEmailRes;
            datagram.Datas       = response.ToByteArray();

            if (!Send(datagram.ToByteArray()))
            {
                Notify(IKXTServer.LogLevel.Error, "数据发送异常");
                Close();
            }
        }