-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.html
113 lines (106 loc) · 4.65 KB
/
index.html
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Team++ Log-in</title>
<link rel="stylesheet" href="LpageStyle.css">
<link rel="icon" href="img/logo.png">
<!--Load bootstrap-->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
crossorigin="anonymous">
<script src="https://www.gstatic.com/firebasejs/5.5.8/firebase.js"></script>
<script>
// Initialize Firebase
var config = {
apiKey: "AIzaSyCDwFS1dxv0WWEbgehMdtsIQ3F_WQlKDnE",
authDomain: "team-plus-plus.firebaseapp.com",
databaseURL: "https://team-plus-plus.firebaseio.com",
projectId: "team-plus-plus",
storageBucket: "",
messagingSenderId: "836611996730"
};
firebase.initializeApp(config);
</script>
<script>
function checkIfSignedIn() {
firebase.auth().onAuthStateChanged(function (user) {
if (user) {
window.location.href = "team.html";
}
});
}
function rememberUser() {
}
function signIn() {
if (firebase.auth().currentUser) {
// Signout if user currently signed in.
firebase.auth().signOut();
}
else {
var userEmail = document.getElementById('inputEmail').value;
var userPass = document.getElementById('inputPassword').value;
var rememberMe = document.getElementById("rememberMe");
if (rememberMe.checked == true) {
firebase.auth().setPersistence(firebase.auth.Auth.Persistence.LOCAL).catch(function (error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
});
}
else {
firebase.auth().setPersistence(firebase.auth.Auth.Persistence.SESSION).catch(function (error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
});
}
firebase.auth().signInWithEmailAndPassword(userEmail, userPass).catch(function (error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
// Alerts user if incorrect password or other errors occur.
if (errorCode === 'auth/wrong-password') {
alert('Wrong password.');
} else {
alert(errorMessage);
}
console.log(error);
});
firebase.auth().onAuthStateChanged(function (user) {
// Moves user to home page once signed in.
if (user) {
window.location.href = "team.html";
}
});
}
}
</script>
</head>
<body class="text-center" onload="checkIfSignedIn()">
<div class="in">
<h1 class="ti"><b>Welcome to Team++!</b>
<h1>
<p class="text-left intro">Built for collaboration,<br />
Team++ is a platorm that will help maximize your team productivity.</p>
</div>
<form class="login">
<img class="mb-3" src="img/logo.png" alt="Team++ Logo" width="150" height="150" />
<label for="inputEmail" class="text-left tag">Email Address</label>
<input type="text" id="inputEmail" class="form-control" placeholder="[email protected]" required autofocus>
<label for="inputPassword" class="text-left tag">Password</label>
<input type="password" id="inputPassword" class="form-control" placeholder="******" required>
<div class="checkbox mb-3">
<label>
<input type="checkbox" id="rememberMe"> Remember me </input>
</label>
</div>
<button class="btn btn-lg btn-primary btn-block" type="button" onclick="signIn()">Sign in</button>
<div class="extra">
<a class="forget" href="./ForgetPasswd.html">Forget password?</a>
<a class="signup" href="./Signup.html">Click here to create a new account</a>
</div>
<p class="cr mt-5 mb-3 text-muted">© Team++</p>
</form>
</body>
</html>