public virtual MailMessage VerifyAccount(VerifyAccountModel model)
        {
            var mailMessage = new MailMessage {Subject = "Verify your account"};

            mailMessage.To.Add(model.EmailAddress);
            ViewBag.Data = model;
            PopulateBody(mailMessage, viewName: "VerifyPassword");

            return mailMessage;
        }
Exemplo n.º 2
0
        public IActionResult VerifyAccount(VerifyAccountModel model)
        {
            var accountToVerify = _accountService.VerifyAccount(model.Token);

            if (accountToVerify.IsSuccessfull == true)
            {
                return(Ok());
            }
            else
            {
                return(NotFound());
            }
        }
Exemplo n.º 3
0
 public Boolean register([FromBody] UserRegistrationModel user)
 {
     if (!isValidateApiUser(user.token))
     {
         return(false);
     }
     try
     {
         if (db.Users.Find(user.user.username) != null)
         {
             return(false);
         }
         user.user.isVerified = false;
         user.user.isActive   = false;
         db.Users.Add(user.user);
         VerifyAccountModel va = new VerifyAccountModel();
         va.username = user.user.username;
         int flag = 0;
         while (flag == 0)
         {
             va.token = Guid.NewGuid().ToString();
             foreach (VerifyAccountModel v in db.VerifyAccounts)
             {
                 if (va.token == v.token)
                 {
                     flag = 0;
                     continue;
                 }
             }
             flag = 1;
         }
         va.gen_time = DateTime.Now;
         db.VerifyAccounts.Add(va);
         db.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         return(false);
     }
 }
Exemplo n.º 4
0
        public ServiceResult <bool> VerifyAccount(VerifyAccountModel model)
        {
            ServiceResult <bool> result = new ServiceResult <bool>();

            if (!ModelState.IsValid)
            {
                result.Code = ReasonCode.MISSING_REQUIRED_FIELDS;
                foreach (string error in ModelState.Values.SelectMany(v => v.Errors.Select(b => b.ErrorMessage)))
                {
                    result.Message += error + Environment.NewLine;
                }

                return(result);
            }

            new MerchantAccountComponent().VerifyAccount(model.MerchantAccount, model.MerchantName, model.InvitationCode);
            result.Data = true;

            return(result);
        }
Exemplo n.º 5
0
        public string register([FromBody] UserModel user)
        {
            try
            {
                if (db.Users.Find(user.username) != null)
                {
                    return("Username Already is in Use.Please try with different Username");
                }
                user.isVerified = true;
                user.isActive   = true;
                db.Users.Add(user);
                VerifyAccountModel va = new VerifyAccountModel();
                va.username = user.username;
                int flag = 0;
                while (flag == 0)
                {
                    va.token = Guid.NewGuid().ToString();
                    foreach (VerifyAccountModel v in db.VerifyAccounts)
                    {
                        if (va.token == v.token)
                        {
                            flag = 0;
                            continue;
                        }
                    }
                    flag = 1;
                }
                va.gen_time = DateTime.Now;
                db.VerifyAccounts.Add(va);
                db.SaveChanges();
                //sending token

                return("Registered Successfully");
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return("Something Went Wrong.Please try again later.");
            }
        }