public ActionResult Register() { Domain.Myfashion.Domain.User user = new Domain.Myfashion.Domain.User(); Api.User.User objApiUser = new Api.User.User(); Domain.Myfashion.Domain.User _user = (Domain.Myfashion.Domain.User)Session["User"]; string str = ""; System.IO.StreamReader sr = new System.IO.StreamReader(Request.InputStream); string line = ""; line = sr.ReadToEnd(); JObject jo = JObject.Parse(line); user.PaymentStatus = "unpaid"; user.AccountType = Server.UrlDecode((string)jo["package"]); user.CreateDate = DateTime.Now; user.ExpiryDate = DateTime.Now.AddMonths(1); user.Id = Guid.NewGuid(); string FirstName = Server.UrlDecode((string)jo["firstname"]); string LastName = Server.UrlDecode((string)jo["lastname"]); string profile = Server.UrlDecode((string)jo["package"]); string Company = Server.UrlDecode((string)jo["Company"]); user.UserName = Server.UrlDecode((string)jo["firstname"]) + " " + Server.UrlDecode((string)jo["lastname"]); user.EmailId = Server.UrlDecode((string)jo["email"]); user.Phone = Server.UrlDecode((string)jo["Phone"]); user.Password = Server.UrlDecode((string)jo["password"]); user.Company = Server.UrlDecode((string)jo["Company"]); //account.User_id = user.Id; //account.Company_id = Guid.NewGuid(); //account.Business_name = Company; string res_Registration = string.Empty; res_Registration = objApiUser.Register(user.EmailId, user.Password, user.AccountType, user.UserName, user.Company, "0"); if (res_Registration == "Email Already Exists") { str = "Email Already Exists"; } else if (res_Registration == "Something Went Wrong") { str = "Something Went Wrong"; } else { Api.User.User obj = new Api.User.User(); user = (User)(new JavaScriptSerializer().Deserialize(obj.Login(user.EmailId, user.Password), typeof(User))); Session["User"] = user; str = "Success"; } return(Content(str)); }
public ActionResult SignIn() { Session.Clear(); Session.RemoveAll(); User _user = (User)Session["User"]; string str = ""; string returnmsg = ""; try { logger.Error("Avinash Login"); User user = new Domain.Myfashion.Domain.User(); string uname = Request.QueryString["username"].ToString(); string pass = Request.QueryString["password"].ToString(); Api.User.User obj = new Api.User.User(); string logindata = obj.Login(uname, pass); str = logindata.Replace("\"", string.Empty).Trim(); if (str != "Not Exist" && !str.Equals("Email Not Exist")) { user = (User)(new JavaScriptSerializer().Deserialize(logindata, typeof(User))); Api.Team.Team ApiobjTeam = new Api.Team.Team(); List <Domain.Myfashion.Domain.Groups> lstgroup = (List <Domain.Myfashion.Domain.Groups>)(new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize(ApiobjTeam.GetTeamByUserId(user.Id.ToString()), typeof(List <Domain.Myfashion.Domain.Groups>))); foreach (Groups item in lstgroup) { System.Web.HttpContext.Current.Session["group"] = item.Id; } if (user == null) { returnmsg = "Invalid Email or Password"; } else { Session["User"] = user; returnmsg = "user"; } return(Content(returnmsg)); } else if (str.Equals("Email Not Exist")) { returnmsg = "Sorry, Socioboard doesn't recognize that username."; return(Content(returnmsg)); } return(Content(returnmsg)); } catch (Exception ex) { logger.Error("UserLogin >>" + ex.Message); logger.Error("UserLogin >>" + ex.StackTrace); return(Content(str)); } }
//[HttpPost] public ActionResult AjaxLogin(string username, string password) { Session.Clear(); Session.RemoveAll(); string returnmsg = string.Empty; User objUser = new User(); string uname = Request.QueryString["username"].ToString(); string pass = Request.QueryString["password"].ToString(); Api.User.User obj = new Api.User.User(); string logindata = obj.Login(uname, pass); string str = logindata.Replace("\"", string.Empty).Trim(); if (str != "Not Exist") { objUser = (User)(new JavaScriptSerializer().Deserialize(logindata, typeof(User))); FormsAuthentication.SetAuthCookie(objUser.UserName, false); } else { objUser = null; // Edited by Antima HttpCookie myCookie = new HttpCookie("logininfo" + uname.Trim()); myCookie.Expires = DateTime.Now.AddDays(-1); Response.Cookies.Add(myCookie); returnmsg = "Invalid Email or Password"; return Content(returnmsg); } #region Unused code //JObject profile = JObject.Parse(obj.Login(uname, pass)); //objUser.Id = Guid.Parse(profile["Id"].ToString()); //objUser.UserName = profile["UserName"].ToString(); //objUser.AccountType = profile["AccountType"].ToString(); //objUser.ProfileUrl = profile["ProfileUrl"].ToString(); //objUser.EmailId = profile["EmailId"].ToString(); //objUser.CreateDate = Convert.ToDateTime(profile["CreateDate"].ToString()); //objUser.ExpiryDate = Convert.ToDateTime(profile["ExpiryDate"].ToString()); //objUser.UserStatus = Convert.ToInt16(profile["UserStatus"].ToString()); //objUser.Password = profile["Password"].ToString(); //objUser.TimeZone = profile["TimeZone"].ToString(); //objUser.PaymentStatus = profile["PaymentStatus"].ToString(); //objUser.ActivationStatus = profile["ActivationStatus"].ToString(); //objUser.CouponCode = profile["CouponCode"].ToString(); //objUser.ReferenceStatus = profile["ReferenceStatus"].ToString(); //objUser.RefereeStatus = profile["RefereeStatus"].ToString(); //objUser.UserType = profile["UserType"].ToString(); #endregion if (objUser.UserType != "SuperAdmin") { if (objUser != null) { if (objUser.ActivationStatus == "1") { int daysremaining = 0; daysremaining = (objUser.ExpiryDate.Date - DateTime.Now.Date).Days; if (daysremaining > 0) { Session["User"] = objUser; returnmsg = "user"; #region Count Used Accounts try { Session["Paid_User"] = "******"; Api.SocialProfile.SocialProfile apiobjSocialProfile = new Api.SocialProfile.SocialProfile(); Session["ProfileCount"] = Convert.ToInt16(apiobjSocialProfile.GetAllSocialProfilesOfUserCount(objUser.Id.ToString()).ToString()); Session["TotalAccount"] = Convert.ToInt16(SBUtils.GetUserPackageProfileCount(objUser.AccountType)); } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion } else { Session["User"] = objUser; Session["Paid_User"] = "******"; returnmsg = "unpaid"; } } else if (objUser.ActivationStatus == "2") { returnmsg = "User Not Exist!"; } else { returnmsg = "notactivated"; } } } else { returnmsg = "SuperAdmin"; Session["User"] = objUser; } return Content(returnmsg); }
public ActionResult Signup() { logger.Error("Register"); User _user=(User)Session["User"]; Domain.Socioboard.Domain.User user = new Domain.Socioboard.Domain.User(); Session["AjaxLogin"] = "******"; string retmsg = string.Empty; try { System.IO.StreamReader sr = new System.IO.StreamReader(Request.InputStream); string line = ""; line = sr.ReadToEnd(); JObject jo = JObject.Parse(line); user.PaymentStatus = "unpaid"; //if (!string.IsNullOrEmpty(Request.QueryString["type"])) //{ // user.AccountType = Request.QueryString["type"]; // ViewBag.DropDownList1 = Request.QueryString["type"]; //} //else //{ // user.AccountType = "Free"; //} user.AccountType = Server.UrlDecode((string)jo["package"]); user.CreateDate = DateTime.Now; user.ExpiryDate = DateTime.Now.AddMonths(1); user.Id = Guid.NewGuid(); user.UserName = Server.UrlDecode((string)jo["firstname"]) + " " + Server.UrlDecode((string)jo["lastname"]); user.EmailId = Server.UrlDecode((string)jo["email"]); user.Password = Server.UrlDecode((string)jo["password"]); user.UserStatus = 1; if (_user != null) { if (_user.ActivationStatus == "1") //If Login from Facebook, then ActivationStatus would be 1, refer to FacebookManager Controller { user.ActivationStatus = "1"; } else { user.ActivationStatus = "0"; } } else { user.ActivationStatus = "0"; } string firstName = Server.UrlDecode((string)jo["firstname"]); string lastName = Server.UrlDecode((string)jo["lastname"]); Api.User.User objApiUser = new Api.User.User(); string res_Registration = objApiUser.Register(user.EmailId, user.Password, user.AccountType, user.UserName, user.ActivationStatus); logger.Error("res_Registration: "+res_Registration); if (res_Registration != "Email Already Exists") { if (user != null) { Api.User.User obj = new Api.User.User(); user = (User)(new JavaScriptSerializer().Deserialize(obj.Login(user.EmailId, user.Password), typeof(User))); Session["User"] = user; retmsg = "user"; } //Domain.Socioboard.Domain.Invitation _Invitation = (Domain.Socioboard.Domain.Invitation)Session["InvitationInfo"]; Api.Invitation.Invitation ApiInvitation = new Api.Invitation.Invitation(); //if (Session["InvitationCode"] != null) //{ // string invitationcode = Session["InvitationCode"].ToString(); // ApiInvitation.AddInvitationInfoBycode(invitationcode, user.EmailId, user.Id.ToString()); //} //if (_Invitation != null) //{ // if (user.EmailId == _Invitation.FriendEmail) // { // string ret = ApiInvitation.UpdateInvitatoinStatus(_Invitation.Id.ToString(), user.Id.ToString()); // } //} } else { retmsg = "Email Already Exists"; } //return Content(retmsg); } catch (Exception ex) { //logger.Error(ex.StackTrace); Console.WriteLine(ex.StackTrace); } //return View("_RegistrationPartial"); return Content(retmsg); }
public ActionResult Signup() { logger.Error("Register"); User _user = (User)Session["User"]; Domain.Socioboard.Domain.User user = new Domain.Socioboard.Domain.User(); Session["AjaxLogin"] = "******"; string retmsg = string.Empty; try { System.IO.StreamReader sr = new System.IO.StreamReader(Request.InputStream); string line = ""; line = sr.ReadToEnd(); JObject jo = JObject.Parse(line); user.PaymentStatus = "unpaid"; user.AccountType = Server.UrlDecode((string)jo["package"]); user.CreateDate = DateTime.Now; user.ExpiryDate = DateTime.Now.AddDays(30); user.Id = Guid.NewGuid(); user.UserName = Server.UrlDecode((string)jo["firstname"]) + " " + Server.UrlDecode((string)jo["lastname"]); user.EmailId = Server.UrlDecode((string)jo["email"]); user.Password = Server.UrlDecode((string)jo["password"]); user.UserStatus = 1; if (_user != null) { if (_user.ActivationStatus == "1") //If Login from Facebook, then ActivationStatus would be 1, refer to FacebookManager Controller { user.ActivationStatus = "1"; user.SocialLogin = _user.SocialLogin; user.ProfileUrl = _user.ProfileUrl; } else { user.ActivationStatus = "0"; } } else { user.ActivationStatus = "0"; } string firstName = Server.UrlDecode((string)jo["firstname"]); string lastName = Server.UrlDecode((string)jo["lastname"]); Api.User.User objApiUser = new Api.User.User(); //string res_Registration = objApiUser.Register(user.EmailId, user.Password, user.AccountType, user.UserName, user.ActivationStatus); string res_Registration = string.Empty; if (Session["twitterlogin"] != null) { if ((string)Session["twitterlogin"] == "twitterlogin") { res_Registration = objApiUser.RegisterbyTwitter(user.EmailId, user.Password, user.AccountType, user.UserName, user.SocialLogin, user.ProfileUrl, user.ActivationStatus); } else { res_Registration = objApiUser.Register(user.EmailId, user.Password, user.AccountType, user.UserName, user.ActivationStatus); } } else { res_Registration = objApiUser.Register(user.EmailId, user.Password, user.AccountType, user.UserName, user.ActivationStatus); } logger.Error("res_Registration: " + res_Registration); if (res_Registration != "Email Already Exists") { if (user != null) { Api.User.User obj = new Api.User.User(); user = (User)(new JavaScriptSerializer().Deserialize(obj.Login(user.EmailId, user.Password), typeof(User))); Session["User"] = user; if (Session["fblogin"] != null) { string accesstoken = (string)Session["AccesstokenFblogin"]; Api.Facebook.Facebook objfacebook = new Api.Facebook.Facebook(); Api.Groups.Groups objgroup = new Api.Groups.Groups(); //Domain.Socioboard.Domain.Groups group = (Domain.Socioboard.Domain.Groups)(new JavaScriptSerializer().Deserialize(objgroup.GetGroupDetailsByUserId(user.Id.ToString()), typeof(Domain.Socioboard.Domain.Groups))); Groups obpgrp = (Groups)(new JavaScriptSerializer().Deserialize(objgroup.GetGroupDeUserId(user.Id.ToString()), typeof(Groups))); objfacebook.AddFacebookAccountWithloginAsync(accesstoken, user.Id.ToString(), obpgrp.Id.ToString()); } if (Session["googlepluslogin"] != null) { string accesstoken = (string)Session["AccesstokenFblogin"]; Api.Youtube.Youtube objYoutube = new Api.Youtube.Youtube(); Api.Groups.Groups objgroup = new Api.Groups.Groups(); //Domain.Socioboard.Domain.Groups group = (Domain.Socioboard.Domain.Groups)(new JavaScriptSerializer().Deserialize(objgroup.GetGroupDetailsByUserId(user.Id.ToString()), typeof(Domain.Socioboard.Domain.Groups))); Groups grp = (Groups)(new JavaScriptSerializer().Deserialize(objgroup.GetGroupDeUserId(user.Id.ToString()), typeof(Groups))); objYoutube.AddYoutubeAccountwithLoginAsync(ConfigurationManager.AppSettings["YtconsumerKey"], ConfigurationManager.AppSettings["YtconsumerSecret"], ConfigurationManager.AppSettings["Ytredirect_uri"], user.Id.ToString(), grp.Id.ToString(), accesstoken); } retmsg = "user"; } //Domain.Socioboard.Domain.Invitation _Invitation = (Domain.Socioboard.Domain.Invitation)Session["InvitationInfo"]; Api.Invitation.Invitation ApiInvitation = new Api.Invitation.Invitation(); if (Session["InvitationCode"] != null) { string invitationcode = Session["InvitationCode"].ToString(); ApiInvitation.AddInvitationInfoBycode(invitationcode, user.EmailId, user.Id.ToString()); } //if (_Invitation != null) //{ // if (user.EmailId == _Invitation.FriendEmail) // { // string ret = ApiInvitation.UpdateInvitatoinStatus(_Invitation.Id.ToString(), user.Id.ToString()); // } //} } else { retmsg = "Email Already Exists"; } //return Content(retmsg); Session.Abandon(); Session.Clear(); Session.RemoveAll(); } catch (Exception ex) { //logger.Error(ex.StackTrace); Console.WriteLine(ex.StackTrace); } //return View("_RegistrationPartial"); return Content(retmsg); }
public async System.Threading.Tasks.Task<ActionResult> AjaxPluginLogin() { Session.Clear(); Session.RemoveAll(); string returnmsg = string.Empty; string uname = Request.Form["email"].ToString(); string pass = Request.Form["password"].ToString(); User objUser = new User(); Api.User.User ApiUser = new Api.User.User(); string logindata = ApiUser.Login(uname, pass); string str = logindata.Replace("\"", string.Empty).Trim(); if (str != "Not Exist" && !str.Equals("Email Not Exist")) { objUser = (User)(new JavaScriptSerializer().Deserialize(logindata, typeof(User))); FormsAuthentication.SetAuthCookie(objUser.UserName, false); Socioboard.Helper.apiClientProvider ac = new Socioboard.Helper.apiClientProvider(System.Configuration.ConfigurationManager.AppSettings["ApiDomainName"] + "/token"); try { Dictionary<string, string> re = await ac.GetTokenDictionary(uname, SBUtils.MD5Hash(pass)); Session["access_token"] = re["access_token"]; } catch (Exception e) { returnmsg = "Invalid Email or Password"; return Content(returnmsg); } } else if (str.Equals("Email Not Exist")) { returnmsg = "Sorry, " + ConfigurationManager.AppSettings["domain"] + " doesn't recognize that username."; return Content(returnmsg); } else { returnmsg = "Invalid Email or Password"; return Content(returnmsg); } if (objUser != null) { if (objUser.ActivationStatus == "1") { int daysremaining = 0; daysremaining = (objUser.ExpiryDate.Date - DateTime.Now.Date).Days; Api.SocialProfile.SocialProfile apiobjSocialProfile = new Api.SocialProfile.SocialProfile(); #region Count Used Accounts try { Session["ProfileCount"] = Convert.ToInt16(apiobjSocialProfile.GetAllSocialProfilesOfUserCount(objUser.Id.ToString()).ToString()); Session["TotalAccount"] = Convert.ToInt16(SBUtils.GetUserPackageProfileCount(objUser.AccountType)); } catch (Exception ex) { Session["ProfileCount"] = 0; Session["TotalAccount"] = 0; } #endregion if (daysremaining > 0) { Session["User"] = objUser; returnmsg = "user"; Session["Paid_User"] = "******"; } else { Session["User"] = objUser; Session["Paid_User"] = "******"; returnmsg = "unpaid"; } } else if (objUser.ActivationStatus == "2") { returnmsg = "User Not Exist!"; } else { returnmsg = "notactivated"; } } return Content(returnmsg); }
public ActionResult Register() { Domain.Myfashion.Domain.User user = new Domain.Myfashion.Domain.User(); Api.User.User objApiUser = new Api.User.User(); Domain.Myfashion.Domain.User _user = (Domain.Myfashion.Domain.User)Session["User"]; string str = ""; System.IO.StreamReader sr = new System.IO.StreamReader(Request.InputStream); string line = ""; line = sr.ReadToEnd(); JObject jo = JObject.Parse(line); user.PaymentStatus = "unpaid"; user.AccountType = Server.UrlDecode((string)jo["package"]); user.CreateDate = DateTime.Now; user.ExpiryDate = DateTime.Now.AddMonths(1); user.Id = Guid.NewGuid(); string FirstName = Server.UrlDecode((string)jo["firstname"]); string LastName = Server.UrlDecode((string)jo["lastname"]); string profile = Server.UrlDecode((string)jo["package"]); string Company = Server.UrlDecode((string)jo["Company"]); user.UserName = Server.UrlDecode((string)jo["firstname"]) + " " + Server.UrlDecode((string)jo["lastname"]); user.EmailId = Server.UrlDecode((string)jo["email"]); user.Phone = Server.UrlDecode((string)jo["Phone"]); user.Password =Server.UrlDecode((string)jo["password"]); user.Company = Server.UrlDecode((string)jo["Company"]); //account.User_id = user.Id; //account.Company_id = Guid.NewGuid(); //account.Business_name = Company; string res_Registration = string.Empty; res_Registration = objApiUser.Register(user.EmailId, user.Password, user.AccountType, user.UserName, user.Company, "0"); if (res_Registration=="Email Already Exists") { str = "Email Already Exists"; } else if (res_Registration == "Something Went Wrong") { str = "Something Went Wrong"; } else { Api.User.User obj = new Api.User.User(); user = (User)(new JavaScriptSerializer().Deserialize(obj.Login(user.EmailId, user.Password), typeof(User))); Session["User"] = user; str = "Success"; } return Content(str); }
public ActionResult SignIn() { Session.Clear(); Session.RemoveAll(); User _user = (User)Session["User"]; string str=""; string returnmsg = ""; try { logger.Error("Avinash Login"); User user = new Domain.Myfashion.Domain.User(); string uname = Request.QueryString["username"].ToString(); string pass = Request.QueryString["password"].ToString(); Api.User.User obj = new Api.User.User(); string logindata = obj.Login(uname, pass); str = logindata.Replace("\"", string.Empty).Trim(); if (str != "Not Exist" && !str.Equals("Email Not Exist")) { user = (User)(new JavaScriptSerializer().Deserialize(logindata, typeof(User))); Api.Team.Team ApiobjTeam = new Api.Team.Team(); List<Domain.Myfashion.Domain.Groups> lstgroup = (List<Domain.Myfashion.Domain.Groups>)(new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize(ApiobjTeam.GetTeamByUserId(user.Id.ToString()), typeof(List<Domain.Myfashion.Domain.Groups>))); foreach (Groups item in lstgroup) { System.Web.HttpContext.Current.Session["group"] = item.Id; } if (user == null) { returnmsg = "Invalid Email or Password"; } else { Session["User"] = user; returnmsg = "user"; } return Content(returnmsg); } else if (str.Equals("Email Not Exist")) { returnmsg = "Sorry, Socioboard doesn't recognize that username."; return Content(returnmsg); } return Content(returnmsg); } catch (Exception ex) { logger.Error("UserLogin >>" + ex.Message); logger.Error("UserLogin >>" + ex.StackTrace); return Content(str); } }
//[HttpPost] public ActionResult AjaxLogin(string username, string password) { Session.Clear(); Session.RemoveAll(); string returnmsg = string.Empty; User objUser = new User(); string uname = Request.QueryString["username"].ToString(); string pass = Request.QueryString["password"].ToString(); Api.User.User obj = new Api.User.User(); string logindata = obj.Login(uname, pass); string str = logindata.Replace("\"", string.Empty).Trim(); if (str != "Not Exist") { objUser = (User)(new JavaScriptSerializer().Deserialize(logindata, typeof(User))); FormsAuthentication.SetAuthCookie(objUser.UserName, false); } else { objUser = null; // Edited by Antima HttpCookie myCookie = new HttpCookie("logininfo" + uname.Trim()); myCookie.Expires = DateTime.Now.AddDays(-1); Response.Cookies.Add(myCookie); returnmsg = "Invalid Email or Password"; return(Content(returnmsg)); } #region Unused code //JObject profile = JObject.Parse(obj.Login(uname, pass)); //objUser.Id = Guid.Parse(profile["Id"].ToString()); //objUser.UserName = profile["UserName"].ToString(); //objUser.AccountType = profile["AccountType"].ToString(); //objUser.ProfileUrl = profile["ProfileUrl"].ToString(); //objUser.EmailId = profile["EmailId"].ToString(); //objUser.CreateDate = Convert.ToDateTime(profile["CreateDate"].ToString()); //objUser.ExpiryDate = Convert.ToDateTime(profile["ExpiryDate"].ToString()); //objUser.UserStatus = Convert.ToInt16(profile["UserStatus"].ToString()); //objUser.Password = profile["Password"].ToString(); //objUser.TimeZone = profile["TimeZone"].ToString(); //objUser.PaymentStatus = profile["PaymentStatus"].ToString(); //objUser.ActivationStatus = profile["ActivationStatus"].ToString(); //objUser.CouponCode = profile["CouponCode"].ToString(); //objUser.ReferenceStatus = profile["ReferenceStatus"].ToString(); //objUser.RefereeStatus = profile["RefereeStatus"].ToString(); //objUser.UserType = profile["UserType"].ToString(); #endregion if (objUser.UserType != "SuperAdmin") { if (objUser != null) { if (objUser.ActivationStatus == "1") { int daysremaining = 0; daysremaining = (objUser.ExpiryDate.Date - DateTime.Now.Date).Days; if (daysremaining > 0) { Session["User"] = objUser; returnmsg = "user"; #region Count Used Accounts try { Session["Paid_User"] = "******"; Api.SocialProfile.SocialProfile apiobjSocialProfile = new Api.SocialProfile.SocialProfile(); Session["ProfileCount"] = Convert.ToInt16(apiobjSocialProfile.GetAllSocialProfilesOfUserCount(objUser.Id.ToString()).ToString()); Session["TotalAccount"] = Convert.ToInt16(SBUtils.GetUserPackageProfileCount(objUser.AccountType)); } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion } else { Session["User"] = objUser; Session["Paid_User"] = "******"; returnmsg = "unpaid"; } } else if (objUser.ActivationStatus == "2") { returnmsg = "User Not Exist!"; } else { returnmsg = "notactivated"; } } } else { returnmsg = "SuperAdmin"; Session["User"] = objUser; } return(Content(returnmsg)); }
public ActionResult Signup() { logger.Error("Register"); User _user = (User)Session["User"]; Domain.Socioboard.Domain.User user = new Domain.Socioboard.Domain.User(); Session["AjaxLogin"] = "******"; string retmsg = string.Empty; try { System.IO.StreamReader sr = new System.IO.StreamReader(Request.InputStream); string line = ""; line = sr.ReadToEnd(); JObject jo = JObject.Parse(line); user.PaymentStatus = "unpaid"; //if (!string.IsNullOrEmpty(Request.QueryString["type"])) //{ // user.AccountType = Request.QueryString["type"]; // ViewBag.DropDownList1 = Request.QueryString["type"]; //} //else //{ // user.AccountType = "Free"; //} user.AccountType = Server.UrlDecode((string)jo["package"]); user.CreateDate = DateTime.Now; user.ExpiryDate = DateTime.Now.AddMonths(1); user.Id = Guid.NewGuid(); user.UserName = Server.UrlDecode((string)jo["firstname"]) + " " + Server.UrlDecode((string)jo["lastname"]); user.EmailId = Server.UrlDecode((string)jo["email"]); user.Password = Server.UrlDecode((string)jo["password"]); user.UserStatus = 1; if (_user != null) { if (_user.ActivationStatus == "1") //If Login from Facebook, then ActivationStatus would be 1, refer to FacebookManager Controller { user.ActivationStatus = "1"; } else { user.ActivationStatus = "0"; } } else { user.ActivationStatus = "0"; } string firstName = Server.UrlDecode((string)jo["firstname"]); string lastName = Server.UrlDecode((string)jo["lastname"]); Api.User.User objApiUser = new Api.User.User(); string res_Registration = objApiUser.Register(user.EmailId, user.Password, user.AccountType, user.UserName, user.ActivationStatus); logger.Error("res_Registration: " + res_Registration); if (res_Registration != "Email Already Exists") { if (user != null) { Api.User.User obj = new Api.User.User(); user = (User)(new JavaScriptSerializer().Deserialize(obj.Login(user.EmailId, user.Password), typeof(User))); Session["User"] = user; retmsg = "user"; } //Domain.Socioboard.Domain.Invitation _Invitation = (Domain.Socioboard.Domain.Invitation)Session["InvitationInfo"]; Api.Invitation.Invitation ApiInvitation = new Api.Invitation.Invitation(); //if (Session["InvitationCode"] != null) //{ // string invitationcode = Session["InvitationCode"].ToString(); // ApiInvitation.AddInvitationInfoBycode(invitationcode, user.EmailId, user.Id.ToString()); //} //if (_Invitation != null) //{ // if (user.EmailId == _Invitation.FriendEmail) // { // string ret = ApiInvitation.UpdateInvitatoinStatus(_Invitation.Id.ToString(), user.Id.ToString()); // } //} } else { retmsg = "Email Already Exists"; } //return Content(retmsg); } catch (Exception ex) { //logger.Error(ex.StackTrace); Console.WriteLine(ex.StackTrace); } //return View("_RegistrationPartial"); return(Content(retmsg)); }
public ActionResult Signup() { logger.Error("Register"); User _user = (User)Session["User"]; Domain.Socioboard.Domain.User user = new Domain.Socioboard.Domain.User(); Session["AjaxLogin"] = "******"; string retmsg = string.Empty; try { System.IO.StreamReader sr = new System.IO.StreamReader(Request.InputStream); string line = ""; line = sr.ReadToEnd(); JObject jo = JObject.Parse(line); user.PaymentStatus = "unpaid"; user.AccountType = Server.UrlDecode((string)jo["package"]); user.CreateDate = DateTime.Now; user.ExpiryDate = DateTime.Now.AddDays(30); user.Id = Guid.NewGuid(); user.UserName = Server.UrlDecode((string)jo["firstname"]) + " " + Server.UrlDecode((string)jo["lastname"]); user.EmailId = Server.UrlDecode((string)jo["email"]); user.Password = Server.UrlDecode((string)jo["password"]); user.UserStatus = 1; if (_user != null) { if (_user.ActivationStatus == "1") //If Login from Facebook, then ActivationStatus would be 1, refer to FacebookManager Controller { user.ActivationStatus = "1"; user.SocialLogin = _user.SocialLogin; user.ProfileUrl = _user.ProfileUrl; } else { user.ActivationStatus = "0"; } } else { user.ActivationStatus = "0"; } string firstName = Server.UrlDecode((string)jo["firstname"]); string lastName = Server.UrlDecode((string)jo["lastname"]); Api.User.User objApiUser = new Api.User.User(); //string res_Registration = objApiUser.Register(user.EmailId, user.Password, user.AccountType, user.UserName, user.ActivationStatus); string res_Registration = string.Empty; if (Session["twitterlogin"] != null) { if ((string)Session["twitterlogin"] == "twitterlogin") { res_Registration = objApiUser.RegisterbyTwitter(user.EmailId, user.Password, user.AccountType, user.UserName, user.SocialLogin, user.ProfileUrl, user.ActivationStatus); } else { res_Registration = objApiUser.Register(user.EmailId, user.Password, user.AccountType, user.UserName, user.ActivationStatus); } } else { res_Registration = objApiUser.Register(user.EmailId, user.Password, user.AccountType, user.UserName, user.ActivationStatus); } logger.Error("res_Registration: " + res_Registration); if (res_Registration != "Email Already Exists") { if (user != null) { Api.User.User obj = new Api.User.User(); user = (User)(new JavaScriptSerializer().Deserialize(obj.Login(user.EmailId, user.Password), typeof(User))); Session["User"] = user; if (Session["fblogin"] != null) { string accesstoken = (string)Session["AccesstokenFblogin"]; Api.Facebook.Facebook objfacebook = new Api.Facebook.Facebook(); Api.Groups.Groups objgroup = new Api.Groups.Groups(); //Domain.Socioboard.Domain.Groups group = (Domain.Socioboard.Domain.Groups)(new JavaScriptSerializer().Deserialize(objgroup.GetGroupDetailsByUserId(user.Id.ToString()), typeof(Domain.Socioboard.Domain.Groups))); Groups obpgrp = (Groups)(new JavaScriptSerializer().Deserialize(objgroup.GetGroupDeUserId(user.Id.ToString()), typeof(Groups))); objfacebook.AddFacebookAccountWithloginAsync(accesstoken, user.Id.ToString(), obpgrp.Id.ToString()); } if (Session["googlepluslogin"] != null) { string accesstoken = (string)Session["AccesstokenFblogin"]; Api.Youtube.Youtube objYoutube = new Api.Youtube.Youtube(); Api.Groups.Groups objgroup = new Api.Groups.Groups(); //Domain.Socioboard.Domain.Groups group = (Domain.Socioboard.Domain.Groups)(new JavaScriptSerializer().Deserialize(objgroup.GetGroupDetailsByUserId(user.Id.ToString()), typeof(Domain.Socioboard.Domain.Groups))); Groups grp = (Groups)(new JavaScriptSerializer().Deserialize(objgroup.GetGroupDeUserId(user.Id.ToString()), typeof(Groups))); objYoutube.AddYoutubeAccountwithLoginAsync(ConfigurationManager.AppSettings["YtconsumerKey"], ConfigurationManager.AppSettings["YtconsumerSecret"], ConfigurationManager.AppSettings["Ytredirect_uri"], user.Id.ToString(), grp.Id.ToString(), accesstoken); } retmsg = "user"; } //Domain.Socioboard.Domain.Invitation _Invitation = (Domain.Socioboard.Domain.Invitation)Session["InvitationInfo"]; Api.Invitation.Invitation ApiInvitation = new Api.Invitation.Invitation(); if (Session["InvitationCode"] != null) { string invitationcode = Session["InvitationCode"].ToString(); ApiInvitation.AddInvitationInfoBycode(invitationcode, user.EmailId, user.Id.ToString()); } //if (_Invitation != null) //{ // if (user.EmailId == _Invitation.FriendEmail) // { // string ret = ApiInvitation.UpdateInvitatoinStatus(_Invitation.Id.ToString(), user.Id.ToString()); // } //} } else { retmsg = "Email Already Exists"; } //return Content(retmsg); Session.Abandon(); Session.Clear(); Session.RemoveAll(); } catch (Exception ex) { //logger.Error(ex.StackTrace); Console.WriteLine(ex.StackTrace); } //return View("_RegistrationPartial"); return(Content(retmsg)); }
public ActionResult AjaxLogin(string username, string password) { string returnmsg = string.Empty; User objUser = new User(); string uname = Request.QueryString["username"].ToString(); string pass = Request.QueryString["password"].ToString(); Api.User.User obj = new Api.User.User(); string logindata = obj.Login(uname, pass); string str = logindata.Replace("\"", string.Empty).Trim(); if (str != "Not Exist") { objUser = (User)(new JavaScriptSerializer().Deserialize(logindata, typeof(User))); } else { objUser = null; returnmsg = "Invalid Email or Password"; return(Content(returnmsg)); } #region Unused code //JObject profile = JObject.Parse(obj.Login(uname, pass)); //objUser.Id = Guid.Parse(profile["Id"].ToString()); //objUser.UserName = profile["UserName"].ToString(); //objUser.AccountType = profile["AccountType"].ToString(); //objUser.ProfileUrl = profile["ProfileUrl"].ToString(); //objUser.EmailId = profile["EmailId"].ToString(); //objUser.CreateDate = Convert.ToDateTime(profile["CreateDate"].ToString()); //objUser.ExpiryDate = Convert.ToDateTime(profile["ExpiryDate"].ToString()); //objUser.UserStatus = Convert.ToInt16(profile["UserStatus"].ToString()); //objUser.Password = profile["Password"].ToString(); //objUser.TimeZone = profile["TimeZone"].ToString(); //objUser.PaymentStatus = profile["PaymentStatus"].ToString(); //objUser.ActivationStatus = profile["ActivationStatus"].ToString(); //objUser.CouponCode = profile["CouponCode"].ToString(); //objUser.ReferenceStatus = profile["ReferenceStatus"].ToString(); //objUser.RefereeStatus = profile["RefereeStatus"].ToString(); //objUser.UserType = profile["UserType"].ToString(); #endregion if (objUser != null) { Session["User"] = objUser; returnmsg = "user"; #region Count Used Accounts try { Api.SocialProfile.SocialProfile apiobjSocialProfile = new Api.SocialProfile.SocialProfile(); Session["ProfileCount"] = Convert.ToInt16(apiobjSocialProfile.GetAllSocialProfilesOfUserCount(objUser.Id.ToString()).ToString()); Session["TotalAccount"] = Convert.ToInt16(SBUtils.GetUserPackageProfileCount(objUser.AccountType)); } catch (Exception ex) { Console.WriteLine(ex.Message); } #endregion } return(Content(returnmsg)); }
public async System.Threading.Tasks.Task <ActionResult> AjaxPluginLogin() { Session.Clear(); Session.RemoveAll(); string returnmsg = string.Empty; string uname = Request.Form["email"].ToString(); string pass = Request.Form["password"].ToString(); User objUser = new User(); Api.User.User ApiUser = new Api.User.User(); string logindata = ApiUser.Login(uname, pass); string str = logindata.Replace("\"", string.Empty).Trim(); if (str != "Not Exist" && !str.Equals("Email Not Exist")) { objUser = (User)(new JavaScriptSerializer().Deserialize(logindata, typeof(User))); FormsAuthentication.SetAuthCookie(objUser.UserName, false); Socioboard.Helper.apiClientProvider ac = new Socioboard.Helper.apiClientProvider(System.Configuration.ConfigurationManager.AppSettings["ApiDomainName"] + "/token"); try { Dictionary <string, string> re = await ac.GetTokenDictionary(uname, SBUtils.MD5Hash(pass)); Session["access_token"] = re["access_token"]; } catch (Exception e) { returnmsg = "Invalid Email or Password"; return(Content(returnmsg)); } } else if (str.Equals("Email Not Exist")) { returnmsg = "Sorry, " + ConfigurationManager.AppSettings["domain"] + " doesn't recognize that username."; return(Content(returnmsg)); } else { returnmsg = "Invalid Email or Password"; return(Content(returnmsg)); } if (objUser != null) { if (objUser.ActivationStatus == "1") { int daysremaining = 0; daysremaining = (objUser.ExpiryDate.Date - DateTime.Now.Date).Days; Api.SocialProfile.SocialProfile apiobjSocialProfile = new Api.SocialProfile.SocialProfile(); #region Count Used Accounts try { Session["ProfileCount"] = Convert.ToInt16(apiobjSocialProfile.GetAllSocialProfilesOfUserCount(objUser.Id.ToString()).ToString()); Session["TotalAccount"] = Convert.ToInt16(SBUtils.GetUserPackageProfileCount(objUser.AccountType)); } catch (Exception ex) { Session["ProfileCount"] = 0; Session["TotalAccount"] = 0; } #endregion if (daysremaining > 0) { Session["User"] = objUser; returnmsg = "user"; Session["Paid_User"] = "******"; } else { Session["User"] = objUser; Session["Paid_User"] = "******"; returnmsg = "unpaid"; } } else if (objUser.ActivationStatus == "2") { returnmsg = "User Not Exist!"; } else { returnmsg = "notactivated"; } } return(Content(returnmsg)); }