Aselia.Server.Register C# (CSharp) Method

Register() public method

public Register ( UserBase user, byte password, string email ) : bool
user UserBase
password byte
email string
return bool
        public override bool Register(UserBase user, byte[] password, string email)
        {
            try
            {
                if (user.Level >= Authorizations.Registered)
                {
                    return false;
                }

                user.Password = password;
                user.Properties["E-Mail"] = email;
                user.Level = Cache.Accounts.Count > 0 ? Authorizations.Registered : Authorizations.NetworkOperator;
                user.Mask.Account = user.Id;
                Cache.Accounts.Add(user.Mask.Account, user);
                user.Commit();

                UsersByAccount.Add(user.Mask.Account, new List<UserBase>(new UserBase[] { user }));

                user.SendNumeric(Numerics.RPL_REGISTERED, ":You are now registered and logged in.  Use /login password to log in next time you connect.");
                return true;
            }
            catch
            {
                return false;
            }
        }