git-svn-id: svn://10.0.0.236/trunk@42002 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
morse%netscape.com 1999-08-03 20:37:18 +00:00
parent 07cde37704
commit 0fd19c92df
6 changed files with 54 additions and 51 deletions

View File

@ -209,7 +209,7 @@
"<p>" +
"<select name='selname' size='15' multiple='multiple'> "
);
for (i=1; (!i>=permissionList.length); i+=2) {
for (i=1; !(i>=permissionList.length); i+=2) {
if (!deleted_permissions[permissionList[i]]) {
top.frames[list_frame].document.write(
"<option value=" + permissionList[i] + ">" +

View File

@ -8,7 +8,6 @@
Components.classes
["component://netscape/walleteditor/walleteditor-world"].createInstance();
walleteditor = walleteditor.QueryInterface(Components.interfaces.nsIWalletEditor);
dump("walleteditor = " + walleteditor + "\n");
function get()
{
@ -56,9 +55,11 @@
var input;
input = get();
/* following is for going to wallet editor from URL line */
/* check for user supplying invalid database key */
if (input.length == 0) {
input = "+name.first+steve++";
flushTables();
BREAK = '+';
return false;
}
BREAK = input[0];
@ -86,6 +87,7 @@
}
}
schemas[j] = valuesLength;
return true;
}
function dumpStrings() {
@ -511,8 +513,11 @@
}
function loadFrames() {
parseInput();
loadMain();
if (!parseInput()) {
setTimeout('parent.generateOutput("Cancel")',0);
} else {
loadMain();
}
}
</script>

View File

@ -447,7 +447,6 @@
}
function loadFrames(){
dump("did not get here");
list = DoGetSignonList();
BREAK = list[0];
signonList = list.split(BREAK);

View File

@ -389,7 +389,7 @@ si_SelectDialog(const char* szMessage, char** pList, PRInt32* pCount)
extern void Wallet_RestartKey();
extern char Wallet_GetKey();
extern PRBool Wallet_BadKey();
extern PRBool Wallet_KeySet();
extern PRBool Wallet_SetKey(PRBool newkey);
extern char * Wallet_Localize(char * genericString);
@ -404,8 +404,8 @@ si_GetKey() {
}
PRBool
si_BadKey() {
return Wallet_BadKey();
si_KeySet() {
return Wallet_KeySet();
}
PRBool
@ -1198,7 +1198,7 @@ si_OkToSave(char *URLName, char *userName) {
char *strippedURLName = 0;
/* do not save signons if user didn't know the key */
if (si_BadKey()) {
if (!si_KeySet()) {
return(-1);
}
@ -1849,12 +1849,10 @@ SI_LoadSignonData(PRBool fullLoad) {
if (fullLoad) {
si_RestartKey();
char * message = Wallet_Localize("IncorrectKey_TryAgain?");
char * failed = Wallet_Localize("KeyFailure");
while (!si_SetKey()) {
if (!Wallet_Confirm(message)) {
Wallet_Alert(failed);
return 1;
}
if (!Wallet_Confirm(message)) {
return 1;
}
}
}
@ -2163,16 +2161,14 @@ si_SaveSignonDataLocked(PRBool fullSave) {
if (fullSave) {
si_RestartKey();
char * message = Wallet_Localize("IncorrectKey_TryAgain?");
char * failed = Wallet_Localize("KeyFailure");
while (!si_SetKey()) {
if (!Wallet_Confirm(message)) {
Wallet_Alert(failed);
return 1;
}
if (!Wallet_Confirm(message)) {
return 1;
}
}
/* do not save signons if user didn't know the key */
if (si_BadKey()) {
if (!si_KeySet()) {
return(-1);
}
}

View File

@ -923,11 +923,7 @@ wallet_ReadFromSublist(nsAutoString& value, XP_List*& resume)
#define maxKeySize 100
char key[maxKeySize+1];
PRUint32 keyPosition = 0;
PRBool keyFailure = PR_FALSE;
#ifndef NECKO
/* avoid bug 9326 */
PUBLIC
#endif
PRBool keyCancel = PR_FALSE;
PRBool keySet = PR_FALSE;
PUBLIC void
@ -944,8 +940,13 @@ Wallet_GetKey() {
}
PUBLIC PRBool
Wallet_BadKey() {
return keyFailure;
Wallet_KeySet() {
return keySet;
}
PUBLIC PRBool
Wallet_CancelKey() {
return keyCancel;
}
PUBLIC nsresult Wallet_ProfileDirectory(nsFileSpec& dirSpec) {
@ -979,7 +980,7 @@ wallet_KeySize() {
PUBLIC PRBool
Wallet_SetKey(PRBool isNewkey) {
if (keySet && !isNewkey) {
if (Wallet_KeySet() && !isNewkey) {
return PR_TRUE;
}
@ -1001,10 +1002,14 @@ Wallet_SetKey(PRBool isNewkey) {
} else {
newkey = wallet_GetString(password);
}
keyCancel = PR_FALSE;
if (newkey == NULL) { /* user hit cancel button */
if (wallet_KeySize() < 0) { /* no password file existed before */
newkey = PL_strdup(""); /* use zero-length password */
} else if (isNewkey) { /* user is changing the password */
newkey = PL_strdup(""); /* use zero-length password */
} else {
keyCancel = PR_TRUE;
return PR_FALSE; /* user could not supply the correct password */
}
}
@ -1027,12 +1032,10 @@ Wallet_SetKey(PRBool isNewkey) {
nsFileSpec dirSpec;
nsresult rval = Wallet_ProfileDirectory(dirSpec);
if (NS_FAILED(rval)) {
keyFailure = PR_TRUE;
return PR_FALSE;
}
nsOutputFileStream strm2(dirSpec + "key");
if (!strm2.is_open()) {
keyFailure = PR_TRUE;
*key = '\0';
return PR_FALSE;
}
@ -1053,7 +1056,6 @@ Wallet_SetKey(PRBool isNewkey) {
strm2.close();
Wallet_RestartKey();
keySet = PR_TRUE;
keyFailure = PR_FALSE;
return PR_TRUE;
} else {
@ -1070,14 +1072,12 @@ Wallet_SetKey(PRBool isNewkey) {
if ((PL_strlen(key) == 0) && (wallet_KeySize() == 0) ) {
Wallet_RestartKey();
keySet = PR_TRUE;
keyFailure = PR_FALSE;
return PR_TRUE;
}
nsFileSpec dirSpec;
nsresult rval = Wallet_ProfileDirectory(dirSpec);
if (NS_FAILED(rval)) {
keyFailure = PR_TRUE;
return PR_FALSE;
}
nsInputFileStream strm(dirSpec + "key");
@ -1086,14 +1086,12 @@ Wallet_SetKey(PRBool isNewkey) {
while (*p) {
if (strm.get() != (*(p++)^Wallet_GetKey()) || strm.eof()) {
strm.close();
keyFailure = PR_TRUE;
*key = '\0';
return PR_FALSE;
}
}
if (strm.get() != ((*key)^Wallet_GetKey()) || strm.eof()) {
strm.close();
keyFailure = PR_TRUE;
*key = '\0';
return PR_FALSE;
}
@ -1103,10 +1101,8 @@ Wallet_SetKey(PRBool isNewkey) {
if (rv) {
Wallet_RestartKey();
keySet = PR_TRUE;
keyFailure = PR_FALSE;
return PR_TRUE;
} else {
keyFailure = PR_TRUE;
*key = '\0';
return PR_FALSE;
}
@ -1184,7 +1180,7 @@ wallet_WriteToFile(char* filename, XP_List* list, PRBool obscure) {
XP_List * list_ptr;
wallet_MapElement * ptr;
if (obscure && Wallet_BadKey()) {
if (obscure && !Wallet_KeySet()) {
return;
}
@ -1807,6 +1803,7 @@ wallet_GetPrefills(
void
wallet_Initialize() {
static PRBool wallet_Initialized = PR_FALSE;
static PRBool wallet_keyInitialized = PR_FALSE;
if (!wallet_Initialized) {
wallet_FetchFieldSchemaFromNetCenter();
wallet_FetchURLFieldSchemaFromNetCenter();
@ -1817,23 +1814,20 @@ wallet_Initialize() {
wallet_ReadFromFile("SchemaConcat.tbl", wallet_SchemaConcat_list, PR_FALSE);
wallet_Initialized = PR_TRUE;
}
if (!wallet_keyInitialized) {
Wallet_RestartKey();
char * message = Wallet_Localize("IncorrectKey_TryAgain?");
char * failed = Wallet_Localize("KeyFailure");
while (!Wallet_SetKey(PR_FALSE)) {
if (!Wallet_Confirm(message)) {
Wallet_Alert(failed);
if (Wallet_CancelKey() || !Wallet_Confirm(message)) {
PR_FREEIF(message);
PR_FREEIF(failed);
return;
}
}
PR_FREEIF(message);
PR_FREEIF(failed);
wallet_ReadFromFile("SchemaValue.tbl", wallet_SchemaToValue_list, PR_TRUE);
wallet_keyInitialized = PR_TRUE;
}
#if DEBUG
@ -1879,7 +1873,7 @@ void WLLT_ChangePassword() {
#ifdef SingleSignon
SI_LoadSignonData(PR_TRUE);
#endif
if (Wallet_BadKey()) {
if (!Wallet_KeySet()) {
return;
}
@ -2176,7 +2170,7 @@ wallet_Capture(nsIDocument* doc, nsString field, nsString value, nsString vcard)
if (!vcard.Length()) {
wallet_Initialize();
wallet_InitializeCurrentURL(doc);
if (Wallet_BadKey()) {
if (!Wallet_KeySet()) {
return;
}
}
@ -2294,7 +2288,7 @@ WLLT_GetNocaptureListForViewer(nsString& aNocaptureList)
PUBLIC void
WLLT_PostEdit(nsAutoString walletList) {
if (Wallet_BadKey()) {
if (Wallet_KeySet()) {
return;
}
@ -2360,6 +2354,9 @@ WLLT_PostEdit(nsAutoString walletList) {
PUBLIC void
WLLT_PreEdit(nsAutoString& walletList) {
wallet_Initialize();
if (!Wallet_KeySet()) {
return;
}
walletList = BREAK;
XP_List * list_ptr;
wallet_MapElement * ptr;
@ -2608,6 +2605,11 @@ WLLT_Prefill(nsIPresShell* shell, nsString url, PRBool quick) {
/* return if no elements were put into the list */
if (!wallet_PrefillElement_list || !XP_ListCount(wallet_PrefillElement_list)) {
if (Wallet_KeySet()) {
char * message = Wallet_Localize("noPrefills");
Wallet_Alert(message);
PR_FREEIF(message);
}
return NS_ERROR_FAILURE; // indicates to caller not to display preview screen
}

View File

@ -13,13 +13,13 @@
# Reserved.
#
IncorrectKey_TryAgain? = Incorrect key. Do you want to try again?
KeyFailure = Key failure! Wallet file will not be opened.
WantToCaptureForm? = Do you want to put the values on this form into your wallet?
WantToSavePassword? = Do you want to save the user name and password for this form?
FollowingItemsCanBePrefilledForYou = Following items can be pre-filled for you.
firstPassword = Select a password for your database (press cancel if you don't want to use a password).
password = Enter your database password.
newPassword = Select a new password for your database (press cancel if you don't want to use a password).
turnOffPassword = Turn off password protection
SelectUser = Select a username to be entered on this form
SelectUserWhosePasswordIsBeingChanged = Select the user whose password is being changed.
PasswordNotification1 = For your convenience, the browser can remember your user names and passwords so you won't have to re-type them when you return to a site.
@ -34,3 +34,4 @@ SavedNopreviews = Forms that won't be previewed before being pre-filled
SavedNocaptures = Forms that won't be saved
NeverSave = Never save this form
BypassThisScreen = Bypass this screen when prefilling this form in the future
noPrefills = There are no fields that can be prefilled.