-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
30e886b
commit 599a64d
Showing
9 changed files
with
179 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
export async function activate(mfaType) { | ||
await LoginManager.validateToken(); | ||
const req = await fetch(`https://api.login.${LoginManager.domain}/2fa/activate`, { | ||
method: 'POST', | ||
headers: { | ||
Authorization: 'Bearer ' + LoginManager.getCookie('token'), | ||
'Content-Type': 'application/json', | ||
}, | ||
body: mfaType, | ||
}); | ||
|
||
if (req.status == 401) { | ||
window.location.href = LoginManager.buildLoginUrl(window.location.href); | ||
return; | ||
} | ||
|
||
return req; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export async function deactivate(password, mfaToken) { | ||
await LoginManager.validateToken(); | ||
const req = await fetch(`https://api.login.${LoginManager.domain}/2fa/deactivate`, { | ||
method: 'POST', | ||
headers: { | ||
Authorization: 'Bearer ' + LoginManager.getCookie('token'), | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({ | ||
Password: password, | ||
MFAToken: mfaToken, | ||
}), | ||
}); | ||
|
||
if (req.status == 401) { | ||
window.location.href = LoginManager.buildLoginUrl(window.location.href); | ||
return; | ||
} | ||
|
||
return req; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export async function verify(password, mfaToken) { | ||
await LoginManager.validateToken(); | ||
const req = await fetch(`https://api.login.${LoginManager.domain}/2fa/verify`, { | ||
method: 'POST', | ||
headers: { | ||
Authorization: 'Bearer ' + LoginManager.getCookie('token'), | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({ | ||
Password: password, | ||
MFAToken: mfaToken, | ||
}), | ||
}); | ||
|
||
if (req.status == 401) { | ||
window.location.href = LoginManager.buildLoginUrl(window.location.href); | ||
return; | ||
} | ||
|
||
return req; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
export async function changePassword(oldPw, email, pw, mfaToken) { | ||
await LoginManager.validateToken(); | ||
const req = await fetch(`https://api.login.${LoginManager.domain}/resetpassword`, { | ||
method: 'POST', | ||
headers: { | ||
Authorization: 'Bearer ' + LoginManager.getCookie('token'), | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({ | ||
OldPassword: oldPw, | ||
Email: email, | ||
Password: pw, | ||
TwoFaToken: mfaToken, | ||
}), | ||
}); | ||
|
||
if (req.status == 401) { | ||
window.location.href = LoginManager.buildLoginUrl(window.location.href); | ||
return; | ||
} | ||
|
||
return req; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export async function deleteAccount(password, mfaToken) { | ||
await LoginManager.validateToken(); | ||
const req = await fetch(`https://api.login.${LoginManager.domain}/user`, { | ||
method: 'DELETE', | ||
headers: { | ||
Authorization: 'Bearer ' + LoginManager.getCookie('token'), | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({ | ||
Password: password, | ||
TwoFaToken: mfaToken, | ||
}), | ||
}); | ||
|
||
if (req.status == 401) { | ||
window.location.href = LoginManager.buildLoginUrl(window.location.href); | ||
return; | ||
} | ||
|
||
return req; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
export async function saveClient(clientId, logoUrl, url, name) { | ||
await LoginManager.validateToken(); | ||
const req = await fetch(`https://api.login.${LoginManager.domain}/user/oauth`, { | ||
method: 'PUT', | ||
headers: { | ||
Authorization: 'Bearer ' + LoginManager.getCookie('token'), | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({ | ||
clientId: clientId, | ||
logoUrl: logoUrl, | ||
url: url, | ||
name: name, | ||
}), | ||
}); | ||
|
||
if (req.status == 401) { | ||
window.location.href = LoginManager.buildLoginUrl(window.location.href); | ||
return; | ||
} | ||
|
||
return req; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
export async function unlinkSocialAccount(provider) { | ||
await LoginManager.validateToken(); | ||
const req = await fetch(`https://api.login.${LoginManager.domain}/unlink/` + provider, { | ||
method: 'GET', | ||
headers: { | ||
Authorization: 'Bearer ' + LoginManager.getCookie('token'), | ||
}, | ||
}); | ||
|
||
if (req.status == 401) { | ||
window.location.href = LoginManager.buildLoginUrl(window.location.href); | ||
return; | ||
} | ||
|
||
return req; | ||
} |
Oops, something went wrong.