示例#1
0
        public static void LoginOrRegister(string FacebookOAuthId, bool redirect = true)
        {
            var list = TableHelper.SelectRows <Member>(TableHelper.MakeDictionary("FacebookOAuthId", FacebookOAuthId));

            if (list.Count == 1)
            {
                //Already registered, login
                Member member = list[0];
                MemberAuthenticationService.CreateAuthCredentials(member);

                member.IsFromMasterLogin = false;
                TitanAuthService.AuthenticateWithChecks(member, false, redirect);
            }
            else if (list.Count == 0)
            {
                //Not registered yet

                if (!redirect)
                {
                    throw new MsgException(L1.ER_USER_NOTFOUND);
                }

                //Redirect to Register page with Facebook
                HttpContext.Current.Response.Redirect("register.aspx?fb=1");
            }
        }
示例#2
0
        public static void Reactivate(string username, string password, string password2)
        {
            MemberAuthenticationService authservice = new MemberAuthenticationService();
            MemberAuthenticationData    data        = new MemberAuthenticationData(username, password, password2);
            Member member = authservice.Authenticate(data, false, HttpContext.Current);

            TitanAuthService.AuthenticateWithChecks(member, true);
        }
示例#3
0
        /// <summary>
        /// Throws MsgException with proper error message
        /// </summary>
        /// <param name="username"></param>
        /// <param name="password"></param>
        /// <param name="password2"></param>
        public static void Login(string username, string password, string password2, bool redirect = true)
        {
            MemberAuthenticationService authservice = new MemberAuthenticationService();
            MemberAuthenticationData    data        = new MemberAuthenticationData(username, password, password2);
            Member member = authservice.Authenticate(data, false, HttpContext.Current);

            TitanAuthService.AuthenticateWithChecks(member, false, redirect);
        }