-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfirstauth.js
More file actions
40 lines (30 loc) · 1.11 KB
/
firstauth.js
File metadata and controls
40 lines (30 loc) · 1.11 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
38
39
40
/*
NanoPlay Website
Copyright (C) Subnodal Technologies. All Rights Reserved.
https://nanoplay.subnodal.com
Licenced by the Subnodal Open-Source Licence, which can be found at LICENCE.md.
*/
namespace("com.subnodal.nanoplay.website.firstauth", function(exports) {
var subElements = require("com.subnodal.subelements");
var resources = require("com.subnodal.nanoplay.website.resources");
window.firstAuth = exports;
exports.finishSetup = function() {
var chosenUsername = document.getElementById("username").value;
if (chosenUsername.trim() == "") {
return;
}
if (chosenUsername.length > 30) {
return;
}
resources.applyUserSetting(resources.userSettings.USERNAME, chosenUsername);
};
resources.registerUserChangeListener(function(isSignedIn, isNewUser) {
subElements.ready(function() {
if (!isSignedIn) {
window.location.replace("/signin.html");
} else if (!isNewUser) {
window.location.replace("/dashboard");
}
});
});
});