Kaynağa Gözat

添加第三方登录model

xuexb 6 yıl önce
ebeveyn
işleme
9bf1fbff1d

+ 33 - 0
mooctest-user-server/src/main/java/cn/iselab/mooctest/user/model/UserThirdParty.java

@@ -0,0 +1,33 @@
+package cn.iselab.mooctest.user.model;
+
+import lombok.Data;
+
+import javax.persistence.*;
+
+/**
+ * @Description: 作用描述
+ * @Author: xuexb
+ * @CreateDate: 19-1-3$ 下午4:50$
+ */
+@Data
+@Entity
+@Table(name = "user_third_party")
+public class UserThirdParty {
+
+    @Id
+    @GeneratedValue
+    private Long id;
+
+    @Column(name = "user_id")
+    private Long userId;
+
+    @Column(name = "third_party_identity")
+    private String thirdPartyIdentity;
+
+    @Column(name = "from")
+    private String from;
+
+    @Column(name = "is_delete")
+    private int isDelete;
+
+}

+ 29 - 0
mooctest-user-server/src/main/java/cn/iselab/mooctest/user/web/ctrl/ThirdPartyLoginController.java

@@ -0,0 +1,29 @@
+package cn.iselab.mooctest.user.web.ctrl;
+
+import cn.iselab.mooctest.user.constants.UrlConstants;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+
+/**
+ * @Description: 作用描述
+ * @Author: xuexb
+ * @CreateDate: 19-1-3$ 下午4:17$
+ */
+@Controller
+public class ThirdPartyLoginController extends BaseController {
+
+    @RequestMapping(value = UrlConstants.API + "github/login}", method = RequestMethod.GET)
+    public String loginByGithub(@RequestParam("code") String code){
+
+        return null;
+    }
+
+    @RequestMapping(value = UrlConstants.API + "third/bind", method = RequestMethod.PUT)
+    public String bind(){
+
+        return null;
+    }
+
+}

+ 4 - 0
mooctest-user-server/src/main/resources/application.yaml

@@ -45,6 +45,10 @@ wechat:
     appId: wx60f06d61f21804be
     appSecret: f84db4dc62377926624093b49ac3be1f
 
+github:
+    clientId: 4e8e65b7e3bdeee9229b
+    clientSecret: a77f1ea04c6f370ec2ad295e29f307565658f8c3
+
 mybatis:
     typeAliasesPackage: cn.iselab.mooctest.user.model
     configuration:

+ 5 - 5
mooctest-user-server/src/main/resources/templates/login.html

@@ -64,16 +64,16 @@
                 </div>
 
                 <div class="flex-c-m">
-                    <a href="#" class="login100-social-item bg1">
+                    <a href="https://open.weixin.qq.com/connect/qrconnect?appid=wx60f06d61f21804be&redirect_uri=http://www.mooctest.net/api/wechat/login&response_type=code&scope=snsapi_login&state=STATE#wechat_redirect" target="_blank" class="login100-social-item bg1">
                         <i class="fa fa-wechat"></i>
                     </a>
 
-                    <a href="#" class="login100-social-item bg2">
-                        <i class="fa fa-qq"></i>
+                    <a href="https://github.com/login/oauth/authorize?client_id=4e8e65b7e3bdeee9229b" class="login100-social-item bg2">
+                        <i class="fa fa-github"></i>
                     </a>
 
-                    <a href="#" class="login100-social-item bg3">
-                        <i class="fa fa-weibo"></i>
+                    <!--<a href="#" class="login100-social-item bg3">-->
+                        <!--<i class="fa fa-weibo"></i>-->
                     </a>
                 </div>