You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
541 B
JavaScript

"use strict";
const Promise = require("bluebird");
const axios = require("axios");
module.exports = function createLoginAgent({ homeserver }) {
return {
getMethods: function () {
return Promise.try(() => {
// axios get /login
}).then((response) => {
// extract available login methods
});
},
login: function ({ token, username, password }) {
// validate either token or (username, password) supplied
return Promise.try(() => {
// axios post /login
}).then((response) => {
// TODO
});
}
};
};