File tree Expand file tree Collapse file tree 6 files changed +7
-50
lines changed
Expand file tree Collapse file tree 6 files changed +7
-50
lines changed Original file line number Diff line number Diff line change 11'use strict' ;
2- var uuid = require ( 'node-uuid' ) ;
32
43module . exports = app => {
54 if ( app . config . debug ) {
@@ -47,7 +46,6 @@ module.exports = app => {
4746 existUser = new ctx . model . User ( ) ;
4847 existUser . githubId = profile . id ;
4948 existUser . active = true ;
50- existUser . accessToken = uuid . v4 ( ) ;
5149 }
5250
5351 // 用户存在,更新字段
@@ -63,7 +61,7 @@ module.exports = app => {
6361 if ( ex . message . indexOf ( 'duplicate key error' ) !== - 1 ) {
6462 let err ;
6563 if ( ex . message . indexOf ( 'email' ) !== - 1 ) {
66- err = new Error ( '您 GitHub 账号的 Email 与之前在 CNodejs 注册的 Email 重复了 ' ) ;
64+ err = new Error ( '您 GitHub 账号的 Email 与之前在 CNodejs 注册的用户名重复了 ' ) ;
6765 err . code = 'duplicate_email' ;
6866 throw err ;
6967 }
@@ -125,4 +123,3 @@ module.exports = app => {
125123 return user ;
126124 } ) ;
127125} ;
128-
Original file line number Diff line number Diff line change @@ -31,12 +31,6 @@ class TopicController extends Controller {
3131
3232 const [ topic , author , replies ] = await service . topic . getFullTopic ( topic_id ) ;
3333
34- if ( ! topic ) {
35- ctx . status = 404 ;
36- ctx . message = '此话题不存在或已被删除。' ;
37- return ;
38- }
39-
4034 // 增加 visit_count
4135 topic . visit_count += 1 ;
4236 // 写入 DB
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ module.exports = app => {
2929 router . post ( '/signup' , createUserLimit , sign . signup ) ;
3030 } else {
3131 // 进行github验证
32- router . redirect ( '/signup ' , '/passport /github' ) ;
32+ router . redirect ( '/singup ' , '/auth /github' ) ;
3333 }
3434
3535 const localStrategy = app . passport . authenticate ( 'local' , {
@@ -43,9 +43,7 @@ module.exports = app => {
4343 router . get ( '/active_account' , sign . activeAccount ) ; // 帐号激活
4444
4545 // github oauth
46- const github = app . passport . authenticate ( 'github' ) ;
47- app . get ( '/passport/github' , github ) ;
48- app . get ( '/passport/github/callback' , github ) ;
46+ app . passport . mount ( 'github' ) ;
4947
5048 router . get ( '/search_pass' , sign . showSearchPass ) ; // 找回密码页面
5149 router . post ( '/search_pass' , sign . updateSearchPass ) ; // 更新密码
@@ -110,4 +108,3 @@ module.exports = app => {
110108
111109 router . get ( '/search' , search . index ) ;
112110} ;
113-
Original file line number Diff line number Diff line change @@ -52,23 +52,21 @@ class ReplyService extends Service {
5252 */
5353 async getRepliesByTopicId ( id ) {
5454 const query = { topic_id : id , deleted : false } ;
55- let replies = await this . ctx . model . Reply . find ( query , '' , {
55+ const replies = await this . ctx . model . Reply . find ( query , '' , {
5656 sort : 'create_at' ,
5757 } ) . exec ( ) ;
5858
5959 if ( replies . length === 0 ) {
6060 return [ ] ;
6161 }
6262
63- replies = replies . filter ( function ( item ) {
64- return ! item . content_is_html
65- } )
66-
6763 return Promise . all (
6864 replies . map ( async item => {
6965 const author = await this . service . user . getUserById ( item . author_id ) ;
7066 item . author = author || { _id : '' } ;
71-
67+ if ( item . content_is_html ) {
68+ return ;
69+ }
7270 item . content = await this . service . at . linkUsers ( item . content ) ;
7371 return item ;
7472 } )
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 2222 "loader-koa" : " ^2.0.1" ,
2323 "lodash" : " ^4.17.5" ,
2424 "markdown-it" : " ^8.4.1" ,
25- "node-uuid" : " ^1.4.8" ,
2625 "nodemailer" : " ^4.6.2" ,
2726 "nodemailer-smtp-transport" : " ^2.7.4" ,
2827 "qiniu" : " ^7.1.3" ,
4746 "scripts" : {
4847 "start" : " egg-scripts start --daemon --title=egg-server-cnode" ,
4948 "stop" : " egg-scripts stop --title=egg-server-cnode" ,
50- "restart" : " npm run stop && npm run start" ,
5149 "docker" : " egg-scripts start --title=egg-server-cnode" ,
5250 "dev" : " egg-bin dev" ,
5351 "debug" : " egg-bin debug" ,
You can’t perform that action at this time.
0 commit comments