MCPcopy Create free account
hub / github.com/Milkyroad/SCiPNET / registerUserWithInfo

Function registerUserWithInfo

public/src/js/register.js:150–189  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

148
149//register user with local auth variables
150function registerUserWithInfo() {
151 cmdHide()
152 firebase.auth().setPersistence(firebase.auth.Auth.Persistence.LOCAL)
153 .then(() => {
154 return firebase.auth().createUserWithEmailAndPassword(emailReg, passReg)
155 .then(function() {
156 firebase.auth().currentUser.updateProfile({
157 displayName: userReg,
158 photoURL: `${clrReg}|-|${titleReg}|-|${classReg}|-|${siteReg}|-|${keyReg}`
159 })
160 .then(function() {
161 UserTag = `${userReg}#${Math.ceil(Math.random()*10000)}`
162 checkUsernameAva("normal", function() {
163 "check"
164 })
165 }, function(error) {
166 appendError(`${String(error).toUpperCase()}<br><hr> <small style="opacity:0.7">Please enter your password again or you can enter "Quit" to exit the registration process.</small>`)
167 cmdShow()
168 if (keyReg == "") {
169 registerState = 6
170 } else {
171 registerState = 7
172 }
173 })
174 })
175 .catch(function(error) {
176 cmdShow()
177 if (error.code == "auth/invalid-email") {
178 appendError(`PLEASE ENTER A VALID EMAIL (The email you have entered: <span class="highlight">${emailReg}</span>)<br><hr> <small style="opacity:0.7">Please enter your email again or you can enter "Quit" to exit the registration process.</small>`)
179 registerState = 8
180 } else if (error.code == "auth/email-already-in-use") {
181 appendError(`THE PROVIDED EMAIL IS ALREADY IN USE BY AN EXISTING USER (The email you have entered: <span class="highlight">${emailReg}</span>)<br><hr> <small style="opacity:0.7">Please enter your email again or you can enter "Quit" to exit the registration process.</small>`)
182 registerState = 8
183 } else {
184 appendError(`${String(error).toUpperCase()}<br><hr> <small style="opacity:0.7">Please enter your password again or you can enter "Quit" to exit the registration process.</small>`)
185 registerState = 6
186 }
187 });
188 })
189}
190
191//setup listener for the personnel login or register menu
192function personnellistClick() {

Callers 1

registerProcessFunction · 0.85

Calls 3

cmdHideFunction · 0.90
appendErrorFunction · 0.90
cmdShowFunction · 0.90

Tested by

no test coverage detected