Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Avatar for KuCalc : devops.
Download
61909 views
1
// Copyright (c) IPython Development Team.
2
// Distributed under the terms of the Modified BSD License.
3
4
define([
5
'base/js/namespace',
6
'base/js/utils',
7
'jquery',
8
], function(IPython, utils, $){
9
"use strict";
10
11
var LoginWidget = function (selector, options) {
12
options = options || {};
13
this.base_url = options.base_url || utils.get_body_data("baseUrl");
14
this.selector = selector;
15
if (this.selector !== undefined) {
16
this.element = $(selector);
17
this.bind_events();
18
}
19
};
20
21
22
23
LoginWidget.prototype.bind_events = function () {
24
var that = this;
25
this.element.find("button#logout").click(function () {
26
window.location = utils.url_join_encode(
27
that.base_url,
28
"logout"
29
);
30
});
31
this.element.find("button#login").click(function () {
32
window.location = utils.url_join_encode(
33
that.base_url,
34
"login"
35
);
36
});
37
};
38
39
// Set module variables
40
IPython.LoginWidget = LoginWidget;
41
42
return {'LoginWidget': LoginWidget};
43
});
44
45