fix: added validation for links
This commit is contained in:
parent
589a9cb527
commit
b4df58765d
@ -5,13 +5,19 @@ let _props = null;
|
||||
AppSettingsPage({
|
||||
build(props) {
|
||||
_props = props;
|
||||
|
||||
const storage = props.settingsStorage.getItem("TOTPs") ?? []
|
||||
const totpEntrys = GetTOTPList(storage)
|
||||
const createButton = TextInput({
|
||||
placeholder: "otpauth://",
|
||||
label: "Add new OTP Link",
|
||||
onChange: (changes) => {
|
||||
storage.push(getTOTPByLink(changes))
|
||||
var link = getTOTPByLink(changes)
|
||||
if(link == null){
|
||||
console.log("link is invalid")
|
||||
return;
|
||||
}
|
||||
storage.push(link)
|
||||
updateStorage(storage)
|
||||
},
|
||||
labelStyle: {
|
||||
|
@ -33,7 +33,7 @@ export function getTOTPByLink(link) {
|
||||
getHashType(algorithm)
|
||||
);
|
||||
} catch (err) {
|
||||
throw new Error("Link is not valid");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user