コード例 #1
0
    protected override void OnLoad(EventArgs e)
    {
        // StaffSessionAuthorize.CheckCooikie();
        Model_Users u = UserSessionController.FrontAppAuthorization(this);



        if (u != null)
        {
            this.UserActive = u;
            if (!u.EmailVerify)
            {
                Page.Master.FindControl("alertbar").Visible = true;
                LinkButton l = (LinkButton)Page.Master.FindControl("sendmailverify");
                l.CommandArgument = u.UserID.ToString();

                if (!string.IsNullOrEmpty(Request.QueryString["resend"]))
                {
                    Page.Master.FindControl("alertbarsentmailcompleted").Visible = true;
                    //Page.Master.FindControl("alertbar").Visible = false;
                }
                else
                {
                    Page.Master.FindControl("alertbarsentmailcompleted").Visible = false;
                }
            }
            //Page.ClientScript.RegisterClientScriptBlock(GetType(), "alertVerify", "alertshow();", true);
        }

        base.OnLoad(e);
    }
コード例 #2
0
    protected override void OnLoad(EventArgs e)
    {
        // StaffSessionAuthorize.CheckCooikie();
        UserSessionController.AdminAppAuthorization(this);

        base.OnLoad(e);
    }
コード例 #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         Model_Users u = UserSessionController.AdminAppAuthLogin(this);
     }
 }
コード例 #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.Page.IsPostBack)
     {
         UserSessionController.Logout();
     }
 }
コード例 #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        this.Page.Title = "KeenProfile Login";
        if (!this.Page.IsPostBack)
        {
            Model_Users u = UserSessionController.FrontAppAuthLogin(this);
            //if (u != null)
            //{
            //    Response.Redirect("/");
            //    Response.End();
            //}


            //string YearSel = string.Empty;
            //for(int i = 0; i < 60; i++)
            //{
            //    int yearstart = 1958;
            //    yearstart = yearstart + i;

            //    YearSel += "<option value=\""+ yearstart + "\" data-content=\""+ yearstart + "\" >"+ yearstart + "</option>";

            //}

            //yearlist.Text = YearSel;
        }
    }
コード例 #6
0
 void OnDestroy()
 {
     lblMessage         = null;
     txtIsbn            = null;
     txtDescription     = null;
     btnStartSession    = null;
     _userSessionClient = null;
 }
コード例 #7
0
        public LoginForm()
        {
            InitializeComponent();

            _UserController = new UserSessionController(_vp);

            FormBorderStyle = FormBorderStyle.None;

            Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 30, 30));
        }
コード例 #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Page        p = new Page();
        Model_Users u = UserSessionController.FrontAppAuthorization(p);

        if (u != null)
        {
            lblprofile.Text = "<i class=\"fa fa-user\" aria-hidden=\"true\"></i> " + u.FirstName + " |&nbsp; <a style=\"color:#fff;\" href=\"http://member.keenprofile.com/logout\" />Log out <i class=\"fa fa-sign-out\" aria-hidden=\"true\"></i></a>";
        }
    }
コード例 #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.Page.Title = "KeenProfile Login";
     if (!this.Page.IsPostBack)
     {
         Model_Users u = UserSessionController.FrontAppAuthLogin(this);
         //if (u != null)
         //{
         //    Response.Redirect("/");
         //    Response.End();
         //}
     }
 }
コード例 #10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         Model_Users u = UserSessionController.AdminAppAuthLogin(this);
     }
     //RegisterHyperLink.NavigateUrl = "Register";
     //OpenAuthLogin.ReturnUrl = Request.QueryString["ReturnUrl"];
     //var returnUrl = HttpUtility.UrlEncode(Request.QueryString["ReturnUrl"]);
     //if (!String.IsNullOrEmpty(returnUrl))
     //{
     //    RegisterHyperLink.NavigateUrl += "?ReturnUrl=" + returnUrl;
     //}
 }
コード例 #11
0
    protected override void OnLoad(EventArgs e)
    {
        // StaffSessionAuthorize.CheckCooikie();
        Model_MainSetting s = new Model_MainSetting();

        this.MainSetting = s.GetMainSetting();
        Model_Users u = UserSessionController.AdminAppAuthorization(this);

        if (u != null)
        {
            this.UserActive = u;
        }

        base.OnLoad(e);
    }
コード例 #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        this.Page.Title = "KeenProfile Reset Password";
        if (!this.Page.IsPostBack)
        {
            Model_Users u = UserSessionController.FrontAppAuthLogin(this);
            if (u != null)
            {
                Response.Redirect("/");
                Response.End();
            }
            else
            {
                if (!string.IsNullOrEmpty(Request.QueryString["e"]))
                {
                    HttpSessionState Hotels2Session = HttpContext.Current.Session;

                    string   q        = StringUtility.DecryptedData(Request.QueryString["e"]);
                    string[] arrq     = q.Split('@');
                    string   qUserID  = arrq[0];
                    string   qSession = arrq[1];

                    if (Hotels2Session[qSession] == null)
                    {
                        ss.InnerHtml            = "Sorry the session is timeout";
                        signup_password.Visible = false;
                        ConfirmPassword.Visible = false;
                        btn_login.Visible       = false;
                        bb.Visible         = false;
                        btn_forgot.Visible = true;
                    }
                }
                else
                {
                    ss.InnerHtml            = "Sorry the session is timeout";
                    signup_password.Visible = false;
                    ConfirmPassword.Visible = false;
                    btn_login.Visible       = false;
                    bb.Visible         = false;
                    btn_forgot.Visible = true;
                }
            }
        }
    }
コード例 #13
0
    protected void btn_login_Click(object sender, EventArgs e)
    {
        Model_Users u = UsersController.UserChecklogin(email_txt.Value.Trim(), password_txt.Value.Trim());

        if (u != null)
        {
            UserSessionController.CloseOtherCurrentLogin(u.UserID);
            UserSessionController.SessionCreateUserFront(u);
        }
        else
        {
            Model_Users ux = UsersController.UserCheckloginExternal(email_txt.Value.Trim());
            if (ux != null)
            {
                string url = Request.Url.ToString().Split('?')[0];

                switch (ux.UserLoginChannel)
                {
                case UserLoginChannel.Application:

                    Response.Redirect(url + "?loginfailed=passwordinvalid");
                    break;

                case UserLoginChannel.Facebook:
                    Response.Redirect(url + "?loginfailed=sociallogin&s=facebook");
                    break;

                case UserLoginChannel.Google:
                    Response.Redirect(url + "?loginfailed=sociallogin&s=google");
                    break;

                case UserLoginChannel.LinkedIn:
                    Response.Redirect(url + "?loginfailed=sociallogin&s=linkedin");
                    break;
                }
            }
            else
            {
            }
            //FailureText.Text = "UserName Invalid";
            //ErrorMessage.Visible = true;
        }
    }
コード例 #14
0
        public VentanaPrincipal(UserSessionModel User)
        {
            InitializeComponent();

            _user = User;

            _user_ctr = new UserSessionController(this);

            if (User.categoria_id == 2)
            {
                _user_ctr.setViewToSellerUser();
            }
            FormBorderStyle = FormBorderStyle.None;

            nombreUsuario.Text = String.Format("Bienvenido {0}", User.Username);
            tipoUsuario.Text   = String.Format("Tipo de usuario: {0}", User.TipoUsuario);

            Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 15, 15));
        }
コード例 #15
0
    protected void LogIn(object sender, EventArgs e)
    {
        Model_Users u = UsersController.AdminChecklogin(UserName.Text, Password.Text);

        if (u != null)
        {
            if (!u.Status)
            {
                HttpContext.Current.Response.Redirect("~/admin/accessdenie.aspx?error=noactivate");
            }
            else
            {
                //StaffSessionAuthorize StaffSession = new StaffSessionAuthorize();
                //StaffSession.CloseOtherCurrentLogin(clStaff.Staff_Id);
                UserSessionController.CloseOtherCurrentLogin(u.UserID);
                UserSessionController.SessionCreate(u);
            }
        }
        else
        {
            FailureText.Text     = "UserName Invalid";
            ErrorMessage.Visible = true;
        }
        //if (IsValid)
        //{
        //    // Validate the user password
        //    //var manager = new UserManager();
        //    //ApplicationUser user = manager.Find(UserName.Text, Password.Text);
        //    //if (user != null)
        //    //{
        //    //    IdentityHelper.SignIn(manager, user, RememberMe.Checked);
        //    //    IdentityHelper.RedirectToReturnUrl(Request.QueryString["ReturnUrl"], Response);
        //    //}
        //    //else
        //    //{
        //    //    FailureText.Text = "Invalid username or password.";
        //    //    ErrorMessage.Visible = true;
        //    //}
        //}
    }
コード例 #16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Page        p = new Page();
        Model_Users u = UserSessionController.FrontAppAuthorization(p);

        if (u != null)
        {
            string fullname = u.FirstName + " " + u.LastName;
            profilename.Text = fullname;
            string strImageUrl = "Theme/fronttheme/assets/keenimg/profileempty.png";

            if (!string.IsNullOrEmpty(u.PicturePath))
            {
                strImageUrl = u.PicturePath;
            }

            imageProfile.ImageUrl       = strImageUrl;
            imageProfile2.ImageUrl      = strImageUrl;
            imageProfile2.AlternateText = fullname;

            // lblprofile.Text = "<i class=\"fa fa-user\" aria-hidden=\"true\"></i> " + u.FirstName + " |&nbsp; <a style=\"color:#fff;\" href=\"http://member.keenprofile.com/logout\" />Log out <i class=\"fa fa-sign-out\" aria-hidden=\"true\"></i></a>";
        }
    }
コード例 #17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (string.IsNullOrEmpty(Request.QueryString["access_token"]))
        {
            return;                                                            //ERROR! No token returned from Facebook!!
        }
        //let's send an http-request to facebook using the token
        string json = GetFacebookUserJSON(Request.QueryString["access_token"]);


        //and Deserialize the JSON response
        JavaScriptSerializer js = new JavaScriptSerializer();

        FacebookUser oUser = js.Deserialize <FacebookUser>(json);

        if (oUser != null)
        {
            //Response.Write("Welcome, " + oUser.name);
            //// Response.Write("<br />id, " + oUser.id);
            //Response.Write("<br />Email : " + oUser.email);
            //Response.Write("<br />First_name: " + oUser.first_name);
            //Response.Write("<br />Last_name: " + oUser.last_name);
            //Response.Write("<br />Gender: " + oUser.gender);
            //Response.Write("<br />Link: " + oUser.link);

            //checkuser facebook channel

            string sex = oUser.gender;

            string userID = oUser.id.ToString();



            // http://graph.facebook.com/10159605614725366/picture?type=large

            string strPicturePath = "http://graph.facebook.com/" + userID + "/picture?type=large";

            Model_Users u = UsersController.UserCheckloginExternal(oUser.email.Trim());
            if (u != null)
            {
                if (string.IsNullOrEmpty(u.PicturePath))
                {
                    u.PicturePath = strPicturePath;
                    u.UpdateUserProfilePicutre(u);
                }


                UserSessionController.CloseOtherCurrentLogin(u.UserID);
                UserSessionController.SessionCreateUserFront(u);
            }
            else
            {
                Model_Users mu = new Model_Users
                {
                    Email            = oUser.email,
                    UserName         = oUser.email,
                    Gender           = (byte)(oUser.gender == "male" ? 1 : 2),
                    Password         = DateTime.Now.ToString("ddmmyyyyhhmmss"),
                    UserCatId        = 1,
                    UserLoginChannel = UserLoginChannel.Facebook,
                    FirstName        = oUser.first_name,
                    LastName         = oUser.last_name,
                    EmailVerify      = false,
                    PicturePath      = strPicturePath
                };
                int ret = UsersController.InsertUserExternal(mu);


                if (ret > 0)
                {
                    Model_Users cmu = UsersController.GetUserbyID(ret);
                    UserSessionController.CloseOtherCurrentLogin(cmu.UserID);
                    UserSessionController.SessionCreateUserFront(cmu);
                }
                else
                {
                    //RadioButton ra =(RadioButton)this.Page.FindControl("tab-2");
                    //ra.Checked = true;
                    //emailerror.EnableClientScript = false;

                    //emailerror.ErrorMessage = "the Email has already use";


                    //ClientScript.RegisterClientScriptBlock(typeof(Page), "myscript", "checkpan()", true);

                    // alert.Text = "the Email has already use";
                }
            }
        }
    }
コード例 #18
0
    //public  Microsoft.Owin.IOwinContext Context { get; set; }
    public void Page_Load(object sender, EventArgs e)
    {
        string client_id     = "81h1zat2gc50un";
        string client_secret = "ZLi6H1m1k6EICMES";
        string code          = Request.QueryString["code"];
        string redirect      = Request.Url.AbsoluteUri.Split('?')[0].Replace("http", "https");



        string URI = "https://www.linkedin.com/uas/oauth2/accessToken";


        // string URI = "http://www.myurl.com/post.php";
        string myParameters = "grant_type=authorization_code&client_id=" + client_id + "&client_secret=" + client_secret + "&code=" + code + "&redirect_uri=" + redirect;

        //Response.Write(URI + "?" + myParameters);
        //Response.End();
        string HtmlResult = string.Empty;

        using (WebClient wc = new WebClient())
        {
            ServicePointManager.SecurityProtocol      = SecurityProtocolType.Tls12;
            wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
            HtmlResult = wc.UploadString(URI, myParameters);
        }


        var jsonHtmlResult = JsonHelper.JsonTODynamic(HtmlResult);



        string urlprofile = "https://api.linkedin.com/v1/people/~:(id,formatted-name,first-name,last-name,email-address,picture-url,picture-urls::(original),headline,public-profile-url,positions)";
        string param      = "oauth2_access_token=" + jsonHtmlResult["access_token"] + "&format=json";


        string userdata = string.Empty;
        //using (WebClient wc = new WebClient())
        //{
        //    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
        //    wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";

        //    userdata = wc.UploadString(urlprofile, param);
        //}

        string         urlcom  = urlprofile + "?" + param;
        HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(urlcom);

        request.Method = "GET";
        ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
        using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
        {
            Stream       dataStream = response.GetResponseStream();
            StreamReader reader     = new StreamReader(dataStream);
            userdata = reader.ReadToEnd();
            reader.Close();
            dataStream.Close();
        }



        var UserJson = JsonHelper.JsonTODynamic(userdata);


        //firstName

        //    lastName emailAddress pictureUrl

        string firstName = UserJson["firstName"];

        string lastName = UserJson["lastName"];

        string emailAddress = UserJson["emailAddress"];

        string pictureUrl = UserJson["pictureUrl"];

        Model_Users u = UsersController.UserCheckloginExternal(emailAddress.Trim());

        if (u != null)
        {
            if (string.IsNullOrEmpty(u.PicturePath))
            {
                u.PicturePath = pictureUrl;
                u.UpdateUserProfilePicutre(u);
            }


            UserSessionController.CloseOtherCurrentLogin(u.UserID);
            UserSessionController.SessionCreateUserFront(u);
        }
        else
        {
            Model_Users mu = new Model_Users
            {
                Email            = emailAddress.Trim(),
                UserName         = emailAddress.Trim(),
                Gender           = 3,
                Password         = DateTime.Now.ToString("ddmmyyyyhhmmss"),
                UserCatId        = 1,
                UserLoginChannel = UserLoginChannel.Facebook,
                FirstName        = firstName,
                LastName         = lastName,
                EmailVerify      = false,
                PicturePath      = pictureUrl
            };
            int ret = UsersController.InsertUserExternal(mu);


            if (ret > 0)
            {
                Model_Users cmu = UsersController.GetUserbyID(ret);
                UserSessionController.CloseOtherCurrentLogin(cmu.UserID);
                UserSessionController.SessionCreateUserFront(cmu);
            }
            else
            {
                //RadioButton ra =(RadioButton)this.Page.FindControl("tab-2");
                //ra.Checked = true;
                //emailerror.EnableClientScript = false;

                //emailerror.ErrorMessage = "the Email has already use";


                //ClientScript.RegisterClientScriptBlock(typeof(Page), "myscript", "checkpan()", true);

                // alert.Text = "the Email has already use";
            }
        }



        //LinkedInConnect.APIKey = "81h1zat2gc50un";
        //LinkedInConnect.APISecret = "ZLi6H1m1k6EICMES";
        //LinkedInConnect.RedirectUrl = Request.Url.AbsoluteUri.Split('?')[0];



        //if (LinkedInConnect.IsAuthorized)
        //{

        //    string ff = (string)Session["access_token"];
        //    pnlDetails.Visible = true;
        //    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
        //    DataSet ds = LinkedInConnect.Fetch();

        //    string json = ds.ObjectToJSON();

        //    Response.Write(json);
        //    Response.End();


        //    imgPicture.ImageUrl = ds.Tables["person"].Rows[0]["picture-url"].ToString();
        //    lblName.Text = ds.Tables["person"].Rows[0]["first-name"].ToString();
        //    lblName.Text += " " + ds.Tables["person"].Rows[0]["last-name"].ToString();
        //    lblEmailAddress.Text = ds.Tables["person"].Rows[0]["email-address"].ToString();
        //    lblHeadline.Text = ds.Tables["person"].Rows[0]["headline"].ToString();
        //    lblIndustry.Text = ds.Tables["person"].Rows[0]["industry"].ToString();
        //    lblLinkedInId.Text = ds.Tables["person"].Rows[0]["id"].ToString();
        //    lblLocation.Text = ds.Tables["location"].Rows[0]["name"].ToString();
        //    imgPicture.ImageUrl = ds.Tables["person"].Rows[0]["picture-url"].ToString();
        //}
    }
コード例 #19
0
    //private static string GetFacebookUserJSON(string access_token)
    //{
    //    string url = string.Format("https://graph.facebook.com/me?access_token={0}&fields=email,name,first_name,last_name,link", access_token);

    //    WebClient wc = new WebClient();
    //    Stream data = wc.OpenRead(url);
    //    StreamReader reader = new StreamReader(data);
    //    string s = reader.ReadToEnd();
    //    data.Close();
    //    reader.Close();

    //    return s;
    //}


    protected void btnSignup_Click(object sender, EventArgs e)
    {
        DateTime    dBirth = new DateTime(int.Parse(useryear.Value), int.Parse(usermonth.Value), int.Parse(userday.Value));
        Model_Users mu     = new Model_Users
        {
            Email            = signup_email.Value.Trim(),
            UserName         = signup_email.Value.Trim(),
            Password         = userpassword.Value.Trim(),
            UserCatId        = 1,
            UserLoginChannel = UserLoginChannel.Application,
            ContryCode       = country_code.Value.Trim(),
            AreaLocation     = area_location.Value.Trim(),
            AreaLocation2    = area_location2.Value.Trim(),
            Gender           = byte.Parse(usergender.Value),
            DateofBirth      = dBirth,
            MobileNumber     = userphone.Value.Trim()
        };

        int ret = UsersController.InsertUser(mu);


        if (ret > 0)
        {
            Model_Users cmu = UsersController.GetUserbyID(ret);
            UserSessionController.CloseOtherCurrentLogin(cmu.UserID);
            UserSessionController.SessionCreateUserFront(cmu);
        }
        else
        {
            if (ret < 0)
            {
                //case already registered;
                Model_Users ux = UsersController.UserCheckloginExternal(signup_email.Value.Trim());
                if (ux != null)
                {
                    string url = Request.Url.ToString().Split('?')[0];

                    switch (ux.UserLoginChannel)
                    {
                    case UserLoginChannel.Application:

                        Response.Redirect(url + "?loginfailed=already");
                        break;

                    case UserLoginChannel.Facebook:
                        Response.Redirect(url + "?loginfailed=sociallogin&s=facebook");
                        break;

                    case UserLoginChannel.Google:
                        Response.Redirect(url + "?loginfailed=sociallogin&s=google");
                        break;

                    case UserLoginChannel.LinkedIn:
                        Response.Redirect(url + "?loginfailed=sociallogin&s=linkedin");
                        break;
                    }
                }
            }


            //RadioButton ra =(RadioButton)this.Page.FindControl("tab-2");
            //ra.Checked = true;
            //emailerror.EnableClientScript = false;

            //emailerror.ErrorMessage = "the Email has already use";


            //ClientScript.RegisterClientScriptBlock(typeof(Page), "myscript", "checkpan()", true);

            // alert.Text = "the Email has already use";
        }
    }
コード例 #20
0
ファイル: btnSearchHandler.cs プロジェクト: Techie09/readr
 public btnSearchHandler()
 {
     _userSessionClient = new UserSessionController();
 }
コード例 #21
0
 public btnStartSessionHandler()
 {
     _userSessionClient = new UserSessionController();
 }