Skip to content

Commit

Permalink
fix login bug and up to 1.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
clvrobj committed Jul 14, 2011
1 parent 63bddf7 commit 7e73bc9
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
5 changes: 4 additions & 1 deletion background.js
Expand Up @@ -67,6 +67,7 @@ var updatePageInfo = function (url) {

var login = function (name, pwd) {
// test auth
pwd = encodeURIComponent(pwd);
var path = 'https://' + name + ':' + pwd + at + pathBody + 'posts/update';
var jqxhr = $.ajax({url: path,
type : 'GET',
Expand All @@ -89,7 +90,9 @@ var login = function (name, pwd) {
});
_getTags();
} else {
// error
// error
var popup = chrome.extension.getViews({type: 'popup'})[0];
popup.loginFailed();
}
});
};
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
@@ -1,6 +1,6 @@
{
"name": "Pinboard Plus",
"version": "1.0.5",
"version": "1.0.6",
"description": "A better chrome extension for Pinboard (http://pinboard.in). Easy to know current page has been saved or not.",
"browser_action": {
"default_icon": "icon_grey_19.png",
Expand Down
3 changes: 2 additions & 1 deletion popup.html
Expand Up @@ -125,6 +125,7 @@
<body>
<div id="state-mask">Loading...</div>
<ul id="login-window">
<li id="login-error" style="display:none;"><span style="color:red;">Login failed</span></li>
<li>
<span style="width: 60px;display: inline-block;">username:</span>
<input id="username" type="text" size="20" />
Expand All @@ -144,7 +145,7 @@
<div class="alert"></div>
</div>
<form id="add-post-form" action="#">
<ul>
<ul>
<li>
<label class="item-title">URL</label>
<input id="url" type="text" style="width:420px" />
Expand Down
11 changes: 11 additions & 0 deletions popup.js
Expand Up @@ -14,6 +14,12 @@ Date.prototype.getTimePassed = function () {
return ret;
};

var loginFailed = function () {
hideLoading();
showLoginWindow();
$('#login-error').show();
};

var renderSuggests = function (suggests) {
if (suggests && suggests.length) {
var suggestsStr = '';
Expand Down Expand Up @@ -127,8 +133,10 @@ hideLoading = function () {
};

var showLoginWindow = function () {
hideLoading();
$('.logo-unlogin').show();
$('#login-window').show();
$('#login-error').hide();
var submit = function () {
showLoading();
var name = $('#login-window #username').val(),
Expand Down Expand Up @@ -206,6 +214,9 @@ var init_autocomplete_suggest = function (o) {
if (shownCount) {
suggestsBox.show();
activeSuggestConbyIndex(0);
} else {
suggestsBox.find('.active').removeClass('active');
suggestsBox.hide();
}
});

Expand Down

0 comments on commit 7e73bc9

Please sign in to comment.