Пример #1
0
        /// <summary>
        /// Basic Login Authentication using local storage profiles
        /// </summary>
        /// <returns><c>true</c>, if in profile was loged, <c>false</c> otherwise.</returns>
        /// <param name="username">Username.</param>
        public bool LogInProfile(string username)
        {
            bool success = false;

            if (m_Profiles.m_Profiles.Count > 0)
            {
                foreach (var profile in m_Profiles.m_Profiles)
                {
                    if (username == profile.username)
                    {
                        currentUser = profile;
                        success     = true;
                    }
                }
            }

            return(success);
        }
Пример #2
0
        /// <summary>
        /// Adds a profile to the current loacl profile data file
        /// </summary>
        /// <param name="username">Username.</param>
        /// <param name="email">Email.</param>
        public void AddProfile(string username, string email)
        {
            //Make sure our Profiles Class isnt null
            if (m_Profiles == null)
            {
                m_Profiles = new EF_Profiles();
            }

            //Make sure our username and email is not empty
            if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(email))
            {
                //Create a new profile
                EF_Profile_Data curProfile = new EF_Profile_Data();
                curProfile.username  = username;
                curProfile.email     = email;
                curProfile.created   = DateTime.Now;
                curProfile.lastLogIn = DateTime.Now;

                m_Profiles.m_Profiles.Add(curProfile);
                SaveProfiles();
                LoadProfiles();
            }
        }
Пример #3
0
 /// <summary>
 /// Logs the out profile.
 /// </summary>
 /// <returns><c>true</c>, if out profile was loged, <c>false</c> otherwise.</returns>
 public void LogOutProfile()
 {
     currentUser = null;
     isLoggedIn  = false;
 }
Пример #4
0
 // Use this for initialization
 void Start()
 {
     isLoggedIn  = false;
     currentUser = null;
 }