Example #1
0
        /// <summary>
        /// Checks the status of the registration
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="userPassword"></param>
        /// <param name="verifyPassword"></param>
        /// <returns>boolean, true if success, false if not</returns>
        private bool CheckRegistrationStatus(string userName, string userPassword, string verifyPassword)
        {
            if (userName != "" && userPassword != "" && verifyPassword != "")
            {
                WebbShopAPI api = new WebbShopAPI();
                return(api.Register(userName, userPassword, verifyPassword));
            }

            return(false);
        }
Example #2
0
        /// <summary>
        /// Registers the user to the database by login details in the paramaters of the method. Method calls WebbShopAPI method for register.
        /// </summary>
        /// <param name="details"></param>
        /// <param name="errorMsg"></param>
        /// <returns>True if successful, else false. Also returns a string error message if fail.</returns>
        internal bool RegisterUser(LoginDetails details, out string errorMsg)
        {
            errorMsg = "";

            // Just to be sure. Sometimes you dont know if APIs written by other people checks the passwords. I know mine does but better safe than sorry.
            if (details.Password == details.VerifiedPassword)
            {
                if (webAPI.Register(details.UserName, details.Password, details.VerifiedPassword))
                {
                    return(true);
                }
                else
                {
                    errorMsg = "Unable to register user";
                    Debug.WriteLine(errorMsg);
                    return(false);
                }
            }
            else
            {
                errorMsg = "Passwords does not match.";
                return(false);
            }
        }