Exemplo n.º 1
0
        public dynamic post_signup(SignUpInputModel model)
        {
            var userId = model.Email.ToGuid();

            var account = Session.Load <UserAccount>(userId);


            if (account != null)//todo- add a behaviour that translates exceptions to json that backbone can use
            {
                throw new InvalidOperationException("A user account for " + model.Email + " already exists");
            }

            account = new UserAccount
            {
                Id         = userId,
                UserName   = model.Email,
                Email      = model.Email,
                SignedUpAt = DateTime.UtcNow,
                Status     = UserAccountStatus.Unverified
            };

            Session.Store(account);

            Bus.Send(new SendEmailRequest
            {
                DisplayName = "WatchR - SignUp",
                To          = model.Email,
                Subject     = "Please verify your email at WatchR.se",
                Body        = "http://watchr.se/#verify/" + userId,
                Service     = "usermanagement",
                Parameters  = userId.ToString()
            });
            return(account);
        }
Exemplo n.º 2
0
        public dynamic post_signup(SignUpInputModel model)
        {
            var userId = model.Email.ToGuid();

            var account = Session.Load<UserAccount>(userId);

            if (account != null)//todo- add a behaviour that translates exceptions to json that backbone can use
                throw new InvalidOperationException("A user account for " + model.Email + " already exists");

            account = new UserAccount
                          {
                              Id = userId,
                              UserName = model.Email,
                              Email = model.Email,
                              SignedUpAt = DateTime.UtcNow,
                              Status = UserAccountStatus.Unverified
                          };

            Session.Store(account);

            Bus.Send(new SendEmailRequest
                         {
                             DisplayName = "WatchR - SignUp",
                             To = model.Email,
                             Subject = "Please verify your email at WatchR.se",
                             Body = "http://watchr.se/#verify/" + userId,
                             Service = "usermanagement",
                             Parameters = userId.ToString()
                         });
            return account;
        }