Ejemplo n.º 1
0
        internal IUser Register(IAccountRegistration creds)
        {
            // encrypt the password??
            creds.Password = BCrypt.Net.BCrypt.HashPassword(creds.Password);
            //sql
            try
            {
                string Id = Guid.NewGuid().ToString();
                int    id = _db.ExecuteScalar <int>(@"
                INSERT INTO users (Id, Email, Password, Username)
                VALUES (@Id, @Email, @Password, @Username);
                SELECT LAST_INSERT_ID();
            ", new
                {
                    Id,
                    creds.Email,
                    creds.Password,
                    creds.Username
                });

                return(new User()
                {
                    Id = Id,
                    Username = creds.Username,
                    Email = creds.Email
                });
            }
            catch (MySqlException e)
            {
                throw e;
            }
        }
Ejemplo n.º 2
0
 public RegisterController(
     IAccountRegistration registration,
     IAccountActivation activation,
     ICodeDistribution codeDistribution,
     ILogger <RegisterController> log
     )
 {
     Registration = registration;
     Activation   = activation;
     Code         = codeDistribution;
     Log          = log;
 }
Ejemplo n.º 3
0
        public override IWebUser Register(IAccountRegistration creds)
        {
            var auth = _provider.Register(creds);

            if (auth == null)
            {
                throw new Exception("Invalid Credentials");
            }
            var user = new WebUser(auth);

            user.SetClaims();
            return(user);
        }
Ejemplo n.º 4
0
 public IUser Register(IAccountRegistration creds)
 {
     return(_repo.Register(creds));
 }
Ejemplo n.º 5
0
 public virtual T Register(IAccountRegistration creds)
 {
     throw new NotImplementedException();
 }