Beispiel #1
0
        public async Task <IHttpActionResult> VerifyEmail(LinkNewPasswordViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Thông tin xác thực không hợp lệ"));
            }

            try
            {
                var res = _uow.Token.Verify(new Core.Entities.Model.Token()
                {
                    UserId = model.UserId,
                    Id     = model.Code
                });

                if (res == true)
                {
                    await _uow.UserProfile.VerifyEmail(model.UserId);
                }

                return(Ok(res));
            }
            catch (BusinessException ex)
            {
                return(BadRequest(ex.Message));
            }
            catch (Exception ex)
            {
                _log.Error(ex);
                return(BadRequest(this.General_Err));
            }
        }
Beispiel #2
0
        public async Task <IHttpActionResult> ResetPassword(LinkNewPasswordViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest("Thông tin cung cấp không hợp lệ"));
            }

            try
            {
                var res = _uow.Token.Verify(new Core.Entities.Model.Token()
                {
                    UserId = model.UserId,
                    Id     = model.Code
                });

                return(Ok(res));
            }
            catch (BusinessException ex)
            {
                return(BadRequest(ex.Message));
            }
            catch (Exception ex)
            {
                _log.Error(ex);
                return(BadRequest(this.General_Err));
            }
        }