Example #1
0
        // Creates an user with password. Hashes the password with auto-generated
        // salt and returns true if user was created and false otherwise.
        public User CreateUserWithPassword(string firstName, string lastName, string street,
                                           int zip, string city, string email, int number, string password)
        {
            string s = account.CreatePasswordHash(password);

            char[] splitter  = { ':' };
            var    split     = s.Split(splitter);
            string salt      = split[0];
            string hashValue = split[1];

            // Checks if customer exists in the database. If customer exists we update,
            // otherwise we create a new customer.
            Customer c = cl.HandleCustomer(firstName, lastName, street, zip, city, email, number);

            return(userDB.CreateUser(c.ID, salt, hashValue));
        }