initial commit
This commit is contained in:
commit
beb0a7adfd
4 changed files with 54 additions and 0 deletions
16
__init__.py
Normal file
16
__init__.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import requests
|
||||
from radicale.auth import BaseAuth
|
||||
|
||||
PLUGIN_CONFIG_SCHEMA = {"auth": {
|
||||
"goacc_url": {"value": "", "type": str}}}
|
||||
|
||||
class Auth(BaseAuth):
|
||||
def __init__(self, configuration):
|
||||
super().__init__(configuration.copy(PLUGIN_CONFIG_SCHEMA))
|
||||
|
||||
def login(self, login, password):
|
||||
url = self.configuration.get("auth", "goacc_url")
|
||||
r = requests.get(url+"/auth/basic", auth=(login, password))
|
||||
if r.text == "ok\n":
|
||||
return login
|
||||
return ""
|
||||
Loading…
Add table
Add a link
Reference in a new issue