Commit 66e5a846 authored by Jasvitha Allamsetty's avatar Jasvitha Allamsetty
Browse files

Upload New File

parent 0754cdb2
Pipeline #37782 canceled with stages
<!DOCTYPE html>
<html>
<head>
<script src="signupj.js"></script>
<style>
body {
font-family: Arial, Helvetica, sans-serif;
}
* {
box-sizing: border-box
}
/* Full-width input fields */
input[type=text], input[type=password] {
width: 100%;
padding: 15px;
margin: 5px 0 22px 0;
display: inline-block;
border: none;
background: #f1f1f1;
}
input[type=text]:focus, input[type=password]:focus {
background-color: #ddd;
outline: none;
}
hr {
border: 1px solid #f1f1f1;
margin-bottom: 25px;
}
/* Set a style for all buttons */
button {
background-color: #4CAF50;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
cursor: pointer;
width: 100%;
opacity: 0.9;
}
button:hover {
opacity: 1;
}
/* Extra styles for the cancel button */
.cancelbtn {
padding: 14px 20px;
background-color: #f44336;
}
/* Float cancel and signup buttons and add an equal width */
.cancelbtn, .signupbtn {
float: left;
width: 50%;
}
/* Add padding to container elements */
.container {
padding: 16px;
}
/* Change styles for cancel button and signup button on extra small screens */
@media screen and (max-width: 300px) {
.cancelbtn, .signupbtn {
width: 100%;
}
}
</style>
</head>
<body>
<form style="border:1px solid #ccc">
<div class="container">
<h1>Sign Up</h1>
<p>Please fill in this form to create an account in TheReachy.</p>
<hr>
<label for="usern"><b>Username</b></label>
<input id='usern' type="text" placeholder="Enter name" name="usern" required>
<label for="email"><b>Email</b></label>
<input id='email' type="text" placeholder="Enter Email" name="email" required>
<label for="phn"><b>Phone number</b></label>
<input id='phn' type="text" placeholder="Enter Phone number" name="phn" required>
<label for="psw"><b>Password</b></label>
<input id='psw' type="password" placeholder="Enter Password" name="psw" required>
<label for="rpasw"><b>Repeat Password</b></label>
<input id='rpasw' type="password" placeholder="Confirm Password" name="rpasw" required>
<label>
<input type="checkbox" checked="checked" name="remember" style="margin-bottom:15px"> Remember me
</label>
<p>By creating an account you agree to our <a href="#" style="color:dodgerblue">Terms & Privacy</a>.</p>
<div>
<button id='can' class="cancelbtn">Cancel</button>
<script type="text/javascript">
document.getElementById("can").onclick = function () {
location.href = "index.html";
};
</script>
<button type="button" id='subs' onclick="mysignup()" class="signupbtn">Sign Up</button>
<script src="https://www.gstatic.com/firebasejs/8.1.2/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.1.2/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.1.2/firebase-database.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.1.2/firebase/init.js"></script>
<script id="mains">
var firebaseConfig = {
apiKey: "AIzaSyAH21OG-l3V-B4_jRJ7_ASlYNhZa9cpEsY",
authDomain: "thireachy.firebaseapp.com",
projectId: "thireachy",
storageBucket: "thireachy.appspot.com",
messagingSenderId: "301538556762",
appId: "1:301538556762:web:9480dab5d9e76a2d5c5163",
measurementId: "G-KVBD696N3C"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
firebase.analytics();
function mysignup() {
var em = document.getElementById('email').value;
var pas = document.getElementById('psw').value;
var repp = document.getElementById('rpasw').value;
var pnnn = document.getElementById('phn').value;
var unn = document.getElementById('usern').value;
if (pas === repp) {
//auth users
firebase.auth().createUserWithEmailAndPassword(em, pas)
.then(userCredential => {
//set data into User database
firebase.database().ref('UserInfo/' + userCredential.user.uid).set({
UserName: unn,
Phonenumber: pnnn,
Email: em,
nofdocs: 0,
Docsuploaded: {}
}).then(success => {
//console.log(user);
window.location = "Login.html";
window.alert("Signup Successful");
});
})
.catch(error => {
switch (error.code) {
case 'auth/email-already-in-use':
alert("Email address " +em + ' already in use.');
break;
case 'auth/invalid-email':
alert('Email address '+ em +' is invalid.');
break;
case 'auth/operation-not-allowed':
alert('Error during sign up.');
break;
case 'auth/weak-password':
alert('Password is not strong enough. Add additional characters including special characters and numbers.');
break;
default:
alert(error.message);
break;
}
});
}
else
alert("Passwords do not match!");
};
</script>
</div>
</form>
</body>
</html>
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment