예제 #1
0
        public EmailVerificationResponse VerifyUser(string userId, string email)
        {
            userId = userId.Replace(" ", "+");
            var user = _cryptoGraphy.DecryptString(userId);

            email = email.Replace(" ", "+");

            var userEmail = _cryptoGraphy.DecryptString(email);


            var emailVerificationResponse = new EmailVerificationResponse();
            var message = string.Empty;

            User authUser = null;

            authUser = _accessTokenRepository.GetUserDetailByIdAndEmail(Convert.ToInt64(user), userEmail);

            if (authUser == null)
            {
                emailVerificationResponse.MessageType = "Fel";
                emailVerificationResponse.Message     = "Ogiltig förfrågan.";
            }
            else if (!authUser.IsVerified)
            {
                _accessTokenRepository.UpdateVerifyFlagForUser(authUser);
                emailVerificationResponse.MessageType = "Framgång";
                emailVerificationResponse.Message     = "Din emailadress är verifierad.";
                message = "Användare tillagd.";
            }
            else
            {
                emailVerificationResponse.MessageType = "Info";
                emailVerificationResponse.Message     = "Email are redan verifierad.";
            }
            //var token = TokenMapper(authUser as User, _accessTokenRepository.CreateToken(authUser));
            //token.Message = message;
            return(emailVerificationResponse);
        }