コード例 #1
0
        public async Task<Confirmed> Get(string id)
        {
           string uid = Encoding.ASCII.GetString(HttpServerUtility.UrlTokenDecode(id));
            Confirmed c = new Confirmed();
            string fullstring = Util.Decrypt(uid, true);
            int index = fullstring.IndexOf("{GreenTime}");
           string  UserName = fullstring.Substring(0, index);
            string Password = fullstring.Substring(index + 11);

            AuthContext context = new AuthContext();
           IdentityUser user = null;
          
            People ps = context.Peoples.Where(p => p.email == UserName).SingleOrDefault();
            ps.emailConfirmed = true;

            using (AuthRepository _repo = new AuthRepository())
            {

                user = await _repo.FindUser(UserName, Password);


                if (user != null)
                {
                    context.updatePeople(ps);
                    c.isConfirmed = true;

                    return c;
                }
            }
        
            return c;
        }
コード例 #2
0
        public async Task <Confirmed> Get(string id)
        {
            string    uid        = Encoding.ASCII.GetString(HttpServerUtility.UrlTokenDecode(id));
            Confirmed c          = new Confirmed();
            string    fullstring = Util.Decrypt(uid, true);
            int       index      = fullstring.IndexOf("{GreenTime}");
            string    UserName   = fullstring.Substring(0, index);
            string    Password   = fullstring.Substring(index + 11);

            AuthContext  context = new AuthContext();
            IdentityUser user    = null;

            People ps = context.Peoples.Where(x => x.Deleted == false).Where(p => p.Email == UserName).SingleOrDefault();

            ps.EmailConfirmed = true;

            using (AuthRepository _repo = new AuthRepository())
            {
                user = await _repo.FindUser(UserName, Password);


                if (user != null)
                {
                    context.PutPeople(ps);
                    c.isConfirmed = true;

                    return(c);
                }
            }

            return(c);
        }