Skip to content

Commit

Permalink
add warning if not login
Browse files Browse the repository at this point in the history
  • Loading branch information
phonglk committed Feb 21, 2017
1 parent 1942f20 commit c24b6cb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
9 changes: 9 additions & 0 deletions app/styles/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,15 @@ body {
}
}

#nologin-message {
padding: 5px;
width: 100%;
background: red;
color: white;
font-family: Tahoma;
font-size: 12px;
}

@import './thread-preview';
@import './side-menu';
@import './emotion-box';
Expand Down
22 changes: 17 additions & 5 deletions app/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,24 @@ export function getCurrentView() {
export function getAuthenticationInformation() {
const queryString = "*:contains('You last') > *:contains('Welcome') > a[href*='member.php?u']";
const username = $(queryString).eq(0).text();
if (username === '') return { isLogin: false };
if (username === '') {
if ($('#nologin-message').length === 0) {
$('.tborder:has(input[name="vb_login_username"])')
.before(`<div id='nologin-message'>Bạn cần phải đăng nhập để sử dụng đầy đủ các chức năng của plugin</div>`);
}
return {
isLogin: false,
};
}
new Function(
$("script:not([src]):contains('SECURITYTOKEN')")
.text()
.replace('SECURITYTOKEN', 'SECURITYTOKEN=window.SECURITYTOKEN')
).call(window);
.text()
.replace('SECURITYTOKEN', 'SECURITYTOKEN=window.SECURITYTOKEN')
).call(window);
const token = window.SECURITYTOKEN;
return { isLogin: true, token, username };
return {
isLogin: true,
token,
username,
};
}

0 comments on commit c24b6cb

Please sign in to comment.