forked from instructure/canvas-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauthentication_providers.js
More file actions
37 lines (33 loc) · 1.04 KB
/
Copy pathauthentication_providers.js
File metadata and controls
37 lines (33 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
define([], function(){
var authenticationProviders = {
hideAllNewAuthTypeForms: function(){
var newForms = document.querySelectorAll(".auth-form-container--new");
Array.prototype.forEach.call(newForms, function(el, id){
el.style.display = "none";
});
},
showFormFor: function(authType){
var formId = authType + "_form";
var form = document.getElementById(formId);
if(form !== null){
form.style.display = "";
setTimeout(function(){
$(form).find(":text:first").focus();
form.scrollIntoView();
}, 100);
}
},
hideNoAuthMessage: function(){
var noAuthMessage = document.getElementById("no_auth");
if(noAuthMessage !== null){
noAuthMessage.style.display = "none";
}
},
changedAuthType: function(authType){
authenticationProviders.hideNoAuthMessage();
authenticationProviders.hideAllNewAuthTypeForms();
authenticationProviders.showFormFor(authType);
}
};
return authenticationProviders;
});