DTcms.Web.UI/DTcms.Web.UI.Page/oauth_login.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using DTcms.BLL;
using DTcms.Common;
using DTcms.Model;
using System;
using System.Web;

namespace DTcms.Web.UI.Page
{
	public class oauth_login : BasePage
	{
		protected string turl = string.Empty;

		protected override void ShowPage()
		{
			base.Init += new EventHandler(this.UserPage_Init);
		}

		private void UserPage_Init(object sender, EventArgs e)
		{
			this.turl = Utils.GetCookie("dt_cookie_url_referrer");
			if (string.IsNullOrEmpty(this.turl) || this.turl == HttpContext.Current.Request.Url.ToString().ToLower())
			{
				this.turl = base.linkurl("usercenter", new object[]
				{
					"index"
				});
			}
			if (base.IsUserLogin())
			{
				HttpContext.Current.Response.Redirect(this.turl);
			}
			else if (HttpContext.Current.Session["oauth_name"] == null || HttpContext.Current.Session["oauth_access_token"] == null || HttpContext.Current.Session["oauth_openid"] == null)
			{
				HttpContext.Current.Response.Redirect(base.linkurl("error", new object[]
				{
					"?msg=" + Utils.UrlEncode("登录失败,用户授权已过期,请重新登录!")
				}));
			}
			else
			{
				DTcms.Model.user_oauth oauthModel = new DTcms.BLL.user_oauth().GetModel(HttpContext.Current.Session["oauth_name"].ToString(), HttpContext.Current.Session["oauth_openid"].ToString());
				if (oauthModel != null)
				{
					DTcms.Model.users model = new DTcms.BLL.users().GetModel(oauthModel.user_name);
					if (model == null)
					{
						HttpContext.Current.Response.Redirect(base.linkurl("error", new object[]
						{
							"?msg=" + Utils.UrlEncode("登录失败,授权用户不存在或已被删除!")
						}));
					}
					else
					{
						HttpContext.Current.Session["dt_session_user_info"] = model;
						HttpContext.Current.Session.Timeout = 45;
						Utils.WriteCookie("dt_cookie_user_name_remember", "DTcms", model.user_name);
						Utils.WriteCookie("dt_cookie_user_pwd_remember", "DTcms", model.password);
						oauthModel.oauth_access_token = HttpContext.Current.Session["oauth_access_token"].ToString();
						new DTcms.BLL.user_oauth().Update(oauthModel);
						HttpContext.Current.Response.Redirect(this.turl);
后面还有 6 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。