Mit Email und Passwort registrieren
Leitet noch nicht auf / weiter Setzt dem User kein Bild und keinen Namen
This commit is contained in:
		@@ -43,8 +43,8 @@ window.onload = function () {
 | 
				
			|||||||
var vue = new Vue({
 | 
					var vue = new Vue({
 | 
				
			||||||
  el: '#vue-app',
 | 
					  el: '#vue-app',
 | 
				
			||||||
  data: {
 | 
					  data: {
 | 
				
			||||||
      email: "",
 | 
					    email: "",
 | 
				
			||||||
      password: ""
 | 
					    password: ""
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  methods: {
 | 
					  methods: {
 | 
				
			||||||
    login() {
 | 
					    login() {
 | 
				
			||||||
@@ -70,10 +70,10 @@ var vue = new Vue({
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    loginemail(){
 | 
					    loginemail() {
 | 
				
			||||||
      firebase.auth().signInWithEmailAndPassword(this.email, this.password).then(result =>{
 | 
					      firebase.auth().signInWithEmailAndPassword(this.email, this.password).then(result => {
 | 
				
			||||||
        checkAuth();
 | 
					        checkAuth();
 | 
				
			||||||
      }).catch(function(error) {
 | 
					      }).catch(function (error) {
 | 
				
			||||||
        // Handle Errors here.
 | 
					        // Handle Errors here.
 | 
				
			||||||
        var errorCode = error.code;
 | 
					        var errorCode = error.code;
 | 
				
			||||||
        var errorMessage = error.message;
 | 
					        var errorMessage = error.message;
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										52
									
								
								express-server/public/javascripts/registerEmail.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								express-server/public/javascripts/registerEmail.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,52 @@
 | 
				
			|||||||
 | 
					// Initialize Firebase
 | 
				
			||||||
 | 
					var config = {
 | 
				
			||||||
 | 
					    apiKey: "AIzaSyCuvwf78cmSDoZ2yS4XxHZhnjUn7yIHYfw",
 | 
				
			||||||
 | 
					    authDomain: "test-667ca.firebaseapp.com",
 | 
				
			||||||
 | 
					    databaseURL: "https://test-667ca.firebaseio.com",
 | 
				
			||||||
 | 
					    projectId: "test-667ca",
 | 
				
			||||||
 | 
					    storageBucket: "test-667ca.appspot.com",
 | 
				
			||||||
 | 
					    messagingSenderId: "221332577314"
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					firebase.initializeApp(config);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					var vue = new Vue({
 | 
				
			||||||
 | 
					    el: '#vue-app',
 | 
				
			||||||
 | 
					    data: {
 | 
				
			||||||
 | 
					        name: "",
 | 
				
			||||||
 | 
					        email: "",
 | 
				
			||||||
 | 
					        picurl: "",
 | 
				
			||||||
 | 
					        password: ""
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    methods: {
 | 
				
			||||||
 | 
					        registerEmail() {
 | 
				
			||||||
 | 
					            var user = firebase.auth().currentUser;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            firebase.auth().createUserWithEmailAndPassword(this.email, this.password).catch(function (error) {
 | 
				
			||||||
 | 
					                // Handle Errors here.
 | 
				
			||||||
 | 
					                var errorCode = error.code;
 | 
				
			||||||
 | 
					                var errorMessage = error.message;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                console.error(error)
 | 
				
			||||||
 | 
					                // ...
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            user.updateProfile({
 | 
				
			||||||
 | 
					                displayName: this.name,
 | 
				
			||||||
 | 
					                photoURL: this.picurl
 | 
				
			||||||
 | 
					            }).then(function () {
 | 
				
			||||||
 | 
					                // Update successful.
 | 
				
			||||||
 | 
					            }).catch(function (error) {
 | 
				
			||||||
 | 
					                console.error(error)
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            user.updateEmail(this.email).then(function () {
 | 
				
			||||||
 | 
					                // Update successful.
 | 
				
			||||||
 | 
					            }).catch(function (error) {
 | 
				
			||||||
 | 
					                console.error(error)
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            window.location.href = "/";
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
@@ -50,6 +50,10 @@ router.get('/dash/:idtoken', function (req, res, next) {
 | 
				
			|||||||
  res.render('dash');
 | 
					  res.render('dash');
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					router.get('/register', (req, res) => {
 | 
				
			||||||
 | 
					  res.status(200).render('registrieremail');
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// SmartShopper
 | 
					// SmartShopper
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,10 +18,9 @@
 | 
				
			|||||||
    <input v-model="password" id="password" type="password">
 | 
					    <input v-model="password" id="password" type="password">
 | 
				
			||||||
    <button id="loginemailbutton" @click="loginemail()">Login with Email</button>
 | 
					    <button id="loginemailbutton" @click="loginemail()">Login with Email</button>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    {{email}}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    <button id="loginbutton" @click="login()">Login with google</button>
 | 
					    <button id="loginbutton" @click="login()">Login with google</button>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <a href="/registrieren"><button>Jetzt mit Email und Passwort Registrieren!</button></a>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <script src="javascripts/login.js"></script>
 | 
					    <script src="javascripts/login.js"></script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										31
									
								
								express-server/views/registrieremail.ejs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								express-server/views/registrieremail.ejs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,31 @@
 | 
				
			|||||||
 | 
					<!DOCTYPE html>
 | 
				
			||||||
 | 
					<html lang="en">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<head>
 | 
				
			||||||
 | 
					    <meta charset="UTF-8">
 | 
				
			||||||
 | 
					    <meta name="viewport" content="width=device-width, initial-scale=1.0">
 | 
				
			||||||
 | 
					    <meta http-equiv="X-UA-Compatible" content="ie=edge">
 | 
				
			||||||
 | 
					    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <script src="https://www.gstatic.com/firebasejs/5.7.0/firebase.js"></script>
 | 
				
			||||||
 | 
					    <title>Registrieren</title>
 | 
				
			||||||
 | 
					</head>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<body>
 | 
				
			||||||
 | 
					    <div id="vue-app">
 | 
				
			||||||
 | 
					        <label for="name">Name: </label>
 | 
				
			||||||
 | 
					        <input v-model="name" type="text" id="name">
 | 
				
			||||||
 | 
					        <label for="email">Email: </label>
 | 
				
			||||||
 | 
					        <input v-model="email" type="email" name="email">
 | 
				
			||||||
 | 
					        <label for="picURL">Bild URL: </label>
 | 
				
			||||||
 | 
					        <input v-model="picurl" type="url" id="picURL">
 | 
				
			||||||
 | 
					        <label for="password">Passwort: </label>
 | 
				
			||||||
 | 
					        <input type="password" id="password" v-model="password">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        <button @click="registerEmail()"></button>
 | 
				
			||||||
 | 
					    </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <script src="javascripts/registerEmail.js"></script>
 | 
				
			||||||
 | 
					</body>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</html>
 | 
				
			||||||
		Reference in New Issue
	
	Block a user