/// <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); }
/// <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(); } }
/// <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; }
// Use this for initialization void Start() { isLoggedIn = false; currentUser = null; }