要求用户在 firefox sdk 插件中设置主密码的命令是什么。如果用户不使用主密码,那么我需要让用户设置主密码。怎么做。我应该使用哪个 token 函数来弹出主密码设置 block 。
提前致谢
最佳答案
var me = Services.wm.getMostRecentWindow(null);
var tokenDB = Cc['@mozilla.org/security/pk11tokendb;1'].getService(Ci.nsIPK11TokenDB);
var master_password = tokenDB.getInternalKeyToken();
var master_password_authenticated;
try {
master_password_authenticated = Components.isSuccessCode(token.login(false)); //login argument is false meaning that if the user had previously entered their master password it will not prompt them now AND if they had not entered it before and it is still valid for the session it will NOT prompt. IF you set it to true then regardless if the user entered it in before or not it will force them to enter it again
} catch (ex) {
master_password_authenticated = false;
}
me.alert('master passsword pass? = ' + master_password_authenticated);
这会告诉您“如果用户有主密码,他们是否获得授权”。
关于javascript - firefox sdk插件中的主密码验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39750016/