Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
solo-1
Commits
9ea3e9c5
Unverified
Commit
9ea3e9c5
authored
Feb 11, 2019
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎨
登录重定向
parent
87cb683f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
48 additions
and
49 deletions
+48
-49
src/main/java/org/b3log/solo/model/Common.java
src/main/java/org/b3log/solo/model/Common.java
+6
-6
src/main/java/org/b3log/solo/processor/IndexProcessor.java
src/main/java/org/b3log/solo/processor/IndexProcessor.java
+38
-39
src/main/java/org/b3log/solo/processor/OAuthGitHubProcessor.java
...n/java/org/b3log/solo/processor/OAuthGitHubProcessor.java
+1
-1
src/main/webapp/js/admin/admin.js
src/main/webapp/js/admin/admin.js
+1
-1
src/main/webapp/start.ftl
src/main/webapp/start.ftl
+2
-2
No files found.
src/main/java/org/b3log/solo/model/Common.java
View file @
9ea3e9c5
...
@@ -22,11 +22,16 @@ package org.b3log.solo.model;
...
@@ -22,11 +22,16 @@ package org.b3log.solo.model;
*
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="https://hacpai.com/member/e">Dongxu Wang</a>
* @author <a href="https://hacpai.com/member/e">Dongxu Wang</a>
* @version 1.7.0.
1, Feb 8
, 2019
* @version 1.7.0.
2, Feb 11
, 2019
* @since 0.3.1
* @since 0.3.1
*/
*/
public
final
class
Common
{
public
final
class
Common
{
/**
* Key of referer.
*/
public
static
final
String
REFERER
=
"referer"
;
/**
/**
* Key of upload msg.
* Key of upload msg.
*/
*/
...
@@ -307,11 +312,6 @@ public final class Common {
...
@@ -307,11 +312,6 @@ public final class Common {
*/
*/
public
static
final
String
UNUSED_TAGS
=
"unusedTags"
;
public
static
final
String
UNUSED_TAGS
=
"unusedTags"
;
/**
* Key of go to.
*/
public
static
final
String
GOTO
=
"goto"
;
/**
/**
* Key of online visitor count.
* Key of online visitor count.
*/
*/
...
...
src/main/java/org/b3log/solo/processor/IndexProcessor.java
View file @
9ea3e9c5
...
@@ -56,7 +56,7 @@ import java.util.Map;
...
@@ -56,7 +56,7 @@ import java.util.Map;
*
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="https://hacpai.com/member/DASHU">DASHU</a>
* @author <a href="https://hacpai.com/member/DASHU">DASHU</a>
* @version 1.2.4.1
4, Feb 7
, 2019
* @version 1.2.4.1
5, Feb 11
, 2019
* @since 0.3.1
* @since 0.3.1
*/
*/
@RequestProcessor
@RequestProcessor
...
@@ -147,31 +147,6 @@ public class IndexProcessor {
...
@@ -147,31 +147,6 @@ public class IndexProcessor {
}
}
}
}
/**
* Shows kill browser page with the specified context.
*
* @param context the specified context
*/
@RequestProcessing
(
value
=
"/kill-browser"
,
method
=
HttpMethod
.
GET
)
public
void
showKillBrowser
(
final
RequestContext
context
)
{
final
HttpServletRequest
request
=
context
.
getRequest
();
final
AbstractFreeMarkerRenderer
renderer
=
new
SkinRenderer
(
context
,
"kill-browser.ftl"
);
final
Map
<
String
,
Object
>
dataModel
=
renderer
.
getDataModel
();
try
{
final
Map
<
String
,
String
>
langs
=
langPropsService
.
getAll
(
Locales
.
getLocale
(
request
));
dataModel
.
putAll
(
langs
);
final
JSONObject
preference
=
preferenceQueryService
.
getPreference
();
dataModelService
.
fillCommon
(
context
,
dataModel
,
preference
);
Keys
.
fillServer
(
dataModel
);
Keys
.
fillRuntime
(
dataModel
);
dataModelService
.
fillMinified
(
dataModel
);
}
catch
(
final
ServiceException
e
)
{
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
context
.
sendError
(
HttpServletResponse
.
SC_NOT_FOUND
);
}
}
/**
/**
* Shows start page.
* Shows start page.
*
*
...
@@ -179,19 +154,17 @@ public class IndexProcessor {
...
@@ -179,19 +154,17 @@ public class IndexProcessor {
*/
*/
@RequestProcessing
(
value
=
"/start"
,
method
=
HttpMethod
.
GET
)
@RequestProcessing
(
value
=
"/start"
,
method
=
HttpMethod
.
GET
)
public
void
showStart
(
final
RequestContext
context
)
{
public
void
showStart
(
final
RequestContext
context
)
{
String
destinationURL
=
context
.
param
(
Common
.
GOTO
);
if
(
StringUtils
.
isBlank
(
destinationURL
))
{
destinationURL
=
Latkes
.
getServePath
()
+
Common
.
ADMIN_INDEX_URI
;
}
else
if
(!
isInternalLinks
(
destinationURL
))
{
destinationURL
=
Latkes
.
getServePath
();
}
if
(
initService
.
isInited
()
&&
null
!=
Solos
.
getCurrentUser
(
context
.
getRequest
(),
context
.
getResponse
()))
{
if
(
initService
.
isInited
()
&&
null
!=
Solos
.
getCurrentUser
(
context
.
getRequest
(),
context
.
getResponse
()))
{
context
.
sendRedirect
(
destinationURL
);
context
.
sendRedirect
(
Latkes
.
getServePath
()
);
return
;
return
;
}
}
String
referer
=
context
.
header
(
"referer"
);
if
(
StringUtils
.
isBlank
(
referer
)
||
!
isInternalLinks
(
referer
))
{
referer
=
Latkes
.
getServePath
();
}
final
AbstractFreeMarkerRenderer
renderer
=
new
SkinRenderer
(
context
,
"start.ftl"
);
final
AbstractFreeMarkerRenderer
renderer
=
new
SkinRenderer
(
context
,
"start.ftl"
);
final
Map
<
String
,
Object
>
dataModel
=
renderer
.
getDataModel
();
final
Map
<
String
,
Object
>
dataModel
=
renderer
.
getDataModel
();
final
HttpServletRequest
request
=
context
.
getRequest
();
final
HttpServletRequest
request
=
context
.
getRequest
();
...
@@ -200,6 +173,7 @@ public class IndexProcessor {
...
@@ -200,6 +173,7 @@ public class IndexProcessor {
dataModel
.
put
(
Common
.
VERSION
,
SoloServletListener
.
VERSION
);
dataModel
.
put
(
Common
.
VERSION
,
SoloServletListener
.
VERSION
);
dataModel
.
put
(
Common
.
STATIC_RESOURCE_VERSION
,
Latkes
.
getStaticResourceVersion
());
dataModel
.
put
(
Common
.
STATIC_RESOURCE_VERSION
,
Latkes
.
getStaticResourceVersion
());
dataModel
.
put
(
Common
.
YEAR
,
String
.
valueOf
(
Calendar
.
getInstance
().
get
(
Calendar
.
YEAR
)));
dataModel
.
put
(
Common
.
YEAR
,
String
.
valueOf
(
Calendar
.
getInstance
().
get
(
Calendar
.
YEAR
)));
dataModel
.
put
(
Common
.
REFERER
,
referer
);
Keys
.
fillRuntime
(
dataModel
);
Keys
.
fillRuntime
(
dataModel
);
dataModelService
.
fillMinified
(
dataModel
);
dataModelService
.
fillMinified
(
dataModel
);
...
@@ -217,13 +191,38 @@ public class IndexProcessor {
...
@@ -217,13 +191,38 @@ public class IndexProcessor {
Solos
.
logout
(
httpServletRequest
,
context
.
getResponse
());
Solos
.
logout
(
httpServletRequest
,
context
.
getResponse
());
String
destinationURL
=
context
.
param
(
Common
.
GOTO
);
String
referer
=
context
.
header
(
"referer"
);
if
(
StringUtils
.
isBlank
(
destinationURL
)
||
!
isInternalLinks
(
destinationURL
))
{
if
(
StringUtils
.
isBlank
(
referer
)
||
!
isInternalLinks
(
referer
))
{
destinationURL
=
Latkes
.
getServePath
();
referer
=
Latkes
.
getServePath
();
}
}
context
.
sendRedirect
(
destinationURL
);
Solos
.
addGoogleNoIndex
(
context
);
Solos
.
addGoogleNoIndex
(
context
);
context
.
sendRedirect
(
referer
);
}
/**
* Shows kill browser page with the specified context.
*
* @param context the specified context
*/
@RequestProcessing
(
value
=
"/kill-browser"
,
method
=
HttpMethod
.
GET
)
public
void
showKillBrowser
(
final
RequestContext
context
)
{
final
HttpServletRequest
request
=
context
.
getRequest
();
final
AbstractFreeMarkerRenderer
renderer
=
new
SkinRenderer
(
context
,
"kill-browser.ftl"
);
final
Map
<
String
,
Object
>
dataModel
=
renderer
.
getDataModel
();
try
{
final
Map
<
String
,
String
>
langs
=
langPropsService
.
getAll
(
Locales
.
getLocale
(
request
));
dataModel
.
putAll
(
langs
);
final
JSONObject
preference
=
preferenceQueryService
.
getPreference
();
dataModelService
.
fillCommon
(
context
,
dataModel
,
preference
);
Keys
.
fillServer
(
dataModel
);
Keys
.
fillRuntime
(
dataModel
);
dataModelService
.
fillMinified
(
dataModel
);
}
catch
(
final
ServiceException
e
)
{
LOGGER
.
log
(
Level
.
ERROR
,
e
.
getMessage
(),
e
);
context
.
sendError
(
HttpServletResponse
.
SC_NOT_FOUND
);
}
}
}
/**
/**
...
@@ -233,7 +232,7 @@ public class IndexProcessor {
...
@@ -233,7 +232,7 @@ public class IndexProcessor {
*
*
* @return whether the destinationURL is an internal link
* @return whether the destinationURL is an internal link
*/
*/
private
boolean
isInternalLinks
(
String
destinationURL
)
{
private
boolean
isInternalLinks
(
final
String
destinationURL
)
{
return
destinationURL
.
startsWith
(
Latkes
.
getServePath
());
return
destinationURL
.
startsWith
(
Latkes
.
getServePath
());
}
}
}
}
src/main/java/org/b3log/solo/processor/OAuthGitHubProcessor.java
View file @
9ea3e9c5
...
@@ -121,7 +121,7 @@ public class OAuthGitHubProcessor {
...
@@ -121,7 +121,7 @@ public class OAuthGitHubProcessor {
*/
*/
@RequestProcessing
(
value
=
"/oauth/github/redirect"
,
method
=
HttpMethod
.
GET
)
@RequestProcessing
(
value
=
"/oauth/github/redirect"
,
method
=
HttpMethod
.
GET
)
public
void
redirectGitHub
(
final
RequestContext
context
)
{
public
void
redirectGitHub
(
final
RequestContext
context
)
{
String
referer
=
context
.
header
(
"referer"
);
String
referer
=
context
.
param
(
"referer"
);
if
(
StringUtils
.
isBlank
(
referer
))
{
if
(
StringUtils
.
isBlank
(
referer
))
{
referer
=
Latkes
.
getServePath
();
referer
=
Latkes
.
getServePath
();
}
}
...
...
src/main/webapp/js/admin/admin.js
View file @
9ea3e9c5
...
@@ -36,7 +36,7 @@ $.extend(Admin.prototype, {
...
@@ -36,7 +36,7 @@ $.extend(Admin.prototype, {
* @description 登出
* @description 登出
*/
*/
logout
:
function
()
{
logout
:
function
()
{
window
.
location
.
href
=
latkeConfig
.
servePath
+
"
/logout
?goto=
"
+
latkeConfig
.
servePath
;
window
.
location
.
href
=
latkeConfig
.
servePath
+
"
/logout
"
;
},
},
toggleMenu
:
function
()
{
toggleMenu
:
function
()
{
if
(
$
(
'
#tabs
'
).
css
(
'
left
'
)
===
'
-240px
'
)
{
if
(
$
(
'
#tabs
'
).
css
(
'
left
'
)
===
'
-240px
'
)
{
...
...
src/main/webapp/start.ftl
View file @
9ea3e9c5
...
@@ -29,11 +29,11 @@
...
@@ -29,11 +29,11 @@
<div id="github">
<div id="github">
<div class="github__icon"
<div class="github__icon"
onclick="window.location.href = '${servePath}/oauth/github/redirect';$('#github').addClass('github--loading')">
onclick="window.location.href = '${servePath}/oauth/github/redirect
?referer=${referer}
';$('#github').addClass('github--loading')">
<img src="${staticServePath}/images/github.png"/>
<img src="${staticServePath}/images/github.png"/>
</div>
</div>
<button class="hover"
<button class="hover"
onclick="window.location.href = '${servePath}/oauth/github/redirect';$('#github').addClass('github--loading')">${useGitHubAccountLoginLabel}</button>
onclick="window.location.href = '${servePath}/oauth/github/redirect
?referer=${referer}
';$('#github').addClass('github--loading')">${useGitHubAccountLoginLabel}</button>
</div>
</div>
<script type="text/javascript" src="${staticServePath}/js/lib/jquery/jquery.min.js" charset="utf-8"></script>
<script type="text/javascript" src="${staticServePath}/js/lib/jquery/jquery.min.js" charset="utf-8"></script>
<script type="text/javascript">
<script type="text/javascript">
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment