app.post("/login/firebase", urlencodedParser, function(req, res) { var email = req.body.email; var password = req.body.password; if (email == "" || password == "") { res.status(400).send("Either email or password is blank"); } ref.authWithPassword(req.body, function(error, authData) { if (error) { res.status(400).send(error); } else { neodb.cypher({ query: "MATCH (u:User {username: {username}}) RETURN u", params: { username: authData.password.email } }, function(err, results) { if (err) { console.log("Neo4j error: " + err); } else { var result = results[0]; if (!result) { addUser(authData.password.email); } } }); res.cookie("currentUser", authData.password.email).send("set current user"); } }); });
login(){ this.setState({ loaded: false }); app.authWithPassword({ "email": this.state.email, "password": this.state.password }, (error, user_data) => { this.setState({ loaded: true }); if(error){ alert('Login Failed. Please try again'); }else{ AsyncStorage.setItem('user_data', JSON.stringify(user_data)); this.props.navigator.push({ component: Account, title: 'Main' }); } }); }
loginWithPW: function(userObj, cb, cbOnRegister) { ref.authWithPassword(userObj, function(err, authData) { if (err) { var message = genErrorMsg(err); if (cbOnRegister) { cbOnRegister(message); } else { cb(message); } console.log(message); } else { authData.email = userObj.email; cachedUser = authData; this.onChange(true); if (cbOnRegister) { cb(authData); cbOnRegister(false); } else { cb(false); } } }.bind(this)); },
login: function(email, pass, cb) { var context = this; cb = arguments[arguments.length - 1]; if (localStorage.token) { if (cb) cb(true); this.onChange(true); return; } if (!!email || !!pass) { ref.authWithPassword({ email: email, password: pass, }, function(error, authData) { if (error) { // console.log('Login Failed!', error); if (cb) cb(false); context.onChange(false); } else { // console.log('Authenticated successfully with payload:', authData); localStorage.token = authData.token; localStorage.email = email; API.login(email); if (cb) cb(true); context.onChange(true); } }); } },
onSignInPress(){ if(!this.state.email || !this.state.password){ this.setState({ emptyPassWordEmailError : "Email or Password is Empty" }) //alert("error") }else{ this.setState({ emptyPassWordEmailError : "" })} let app = new Firebase("https://todoappmuneer.firebaseio.com/") //let userNode = new Firebase("https://todoappmuneer.firebaseio.com/production/users/"+user_name) app.authWithPassword({ 'email':this.state.email, 'password':this.state.password, }, (error,authData) => { if(error) { //alert(error.code) switch(error.code){ case 'INVALID_PASSWORD': alert("Incorrect Password Or Email") break case 'INVALID_USER': alert("New User ? Please Register With Us") break default : alert(error.code) } this.removeToken(); }else { let _email = authData.password.email let _uid = authData.uid this.storeToken(_email,_uid) this.getToken() this.redirect('mainScreen') } } ); }
supplementInfo() { var that = this; var ref = new Firebase("https://project-sapphire.firebaseio.com"); ref.authWithPassword({ email: that.props.email, password: that.props.password }, function(error, authData) { if (error) { console.log("Login Failed!", error); // Shows error on client if login fails that.setState({ error: 'Login Failed!', isLoading: false }); } else { console.log("Authenticated successfully with payload:", authData); // navigate to Dashboard api.setUserData(authData, that.state.name, that.state.phoneNumber); that.props.navigator.push({ title: 'Friends', component: TabBar, passProps: {userInfo: authData} }); } }) }
router.post('/login', function(req, res, next) { var email = req.body.email; var password = req.body.password; // Validation req.checkBody('email', 'Email is required').notEmpty(); req.checkBody('email', 'Email is not valid').isEmail(); req.checkBody('password', 'Password is required').notEmpty(); var errors = req.validationErrors(); if(errors){ res.render('users/login', { errors: errors }); } else { fbRef.authWithPassword({ email: email, password: password }, function(error, authData){ if(error){ console.log("Login Failed: ", error); req.flash('error_msg', 'Login Failed'); res.redirect('/users/login'); } else { console.log("Authenticated user with uid:",authData); req.flash('success_msg', 'You are now logged in'); res.redirect('/albums'); } }); } });
return new Promise(( resolve, reject) => { ref.authWithPassword({ email: user.email, password: user.password }, (error, authData) => { if(error) { reject(error); } resolve(authData); }); });
form.parse(req, function (err, fields, files) { firebase.authWithPassword(fields, function (error, authData) { if (error) { res.render('login', { error: true }); } else { res.redirect('/'); } }); });
_authLogIn:function(authDataObject){ fbRef.authWithPassword(authDataObject, function(err, authData){ console.log('err:', err) console.log('authData:', authData) if (err) { alert('not signed in') } else { rtr.navigate('#bloglist', {trigger:true} ) } }) },
before(function (done) { rootRef.authWithPassword({ email: '*****@*****.**', password: '******' }, function (err) { if (err) { done(err); } else { done(); } }); });
$scope.login = function() { myFirebaseRef.authWithPassword({ email: $scope.user.email, password: $scope.user.password }, function(error, authData) { if (error) { alert(error); } else { User.setUser(authData); $state.go('home'); } }); }
loginWithPW(userObj, cb){ this.ref.authWithPassword(userObj, function(err, authData) { if (err) { var message = genErrorMsg(err); cb && cb(message); console.error(message); } else { this.getUserFromFirebase(authData.uid, function (snap) { cb && cb(false, snap.val()); }.bind(this)); } }.bind(this)); }
function login(email, password) { ref.authWithPassword({ email: email, password: password }, function(error, authData) { if (error) { console.log("Login Failed!", error); } else { console.log("Authenticated successfully with payload:", authData); window.location.href ="#/submit"; } }); }
onSignin() { app.authWithPassword({ 'email': this.state.email, 'password': this.state.password }, (error, userData) => { if (error) { alert(error); } else { AsyncStorage.setItem('userData', JSON.stringify(userData)); this.props.navigator.immediatelyResetRouteStack([{ name: 'home' }]); } }); }
userSchema.statics.login = function(userObj, cb) { if(!userObj.email || !userObj.password) { return cb("Missing required field (email, password)"); } ref.authWithPassword(userObj, function(err, authData) { if (err) return cb(err); User.findOne({firebaseId: authData.uid}, function (err, user) { if(err || !user) return cb(err || "User not found in database."); var token = user.generateToken(); cb(null,token); }); }); }
loginWithPW: function(userObj, cb, cbOnRegister){ ref.authWithPassword(userObj, function(err, authData){ if(err){ console.log('Error on login:', err.message); cbOnRegister && cbOnRegister(false); } else { authData.email = userObj.email; cachedUser = authData; cb(authData); this.onChange(true); cbOnRegister && cbOnRegister(true); } }.bind(this)); },
return new Promise((next, error) => { let callback = function (err, authData) { if(err) error(err); else next(authData); }; if(data && data.email && data.password) { this.firebase.authWithPassword(data, callback); }else{ this.firebase.authWithCustomToken(data, callback); } })
onPress: function() { var ref = new Firebase("https://reactapplogin.firebaseio.com"); var self = this; ref.authWithPassword({ email : this.state.email, password : this.state.password }, function(error, authData) { if (error) { console.log("Login Failed!", error); self.setState({errorMessage: 'Please check your credentials and try again'}); } else { console.log("Authenticated successfully with payload:", authData); return self.props.navigator.immediatelyResetRouteStack([{name: 'homepage'}]); } }); }
router.post('/userAuth', function(req, res){ var ref = new Firebase('https://snatch-and-go.firebaseio.com/'); ref.authWithPassword({ email : req.body.user.email, password: req.body.user.pass }, function (error, authData) { if (error) { console.log("Login Failed!", error); } else { console.log("Authenticated successfully!", authData); res.statusCode = 302; res.setHeader("Location", '/'); res.end(); } }); });
return new Promise((resolve, reject) => { return this.db.authWithPassword({ "email": email, "password": password }, function(error, authData) { self.db.onAuth(self.onAuthCallback); self.db.offAuth(self.onAuthCallback); if (error) { console.error(error); return reject(error); } else { self.loggedInUser = authData; return resolve(authData); } }); });
return function(dispatch) { ref.authWithPassword({ email: email, password: password }).then(data => { console.log("Authenticated successfully with payload:", data); dispatch({ type: 'LOGIN', uid: data.uid, }); }).then(error => { console.log("Route"); nav.push({ name: 'contacts' }); }); }
_handlePress : function(event){ var username=this.state.username; var password=this.state.password; var ref = new Firebase("https://burning-fire-1723.firebaseio.com"); ref.authWithPassword({ email : username, password : password }, function(error, authData) { if (error) { console.log("Login Failed!", error); } else { console.log("Authenticated successfully with payload:"); } }); },
return function(dispatch) { ref.authWithPassword({ email: credentials.email, password: credentials.password }, function(error, authData) { if (error) { dispatch(authError(error)); } else { dispatch({ type: SIGN_IN_USER }); console.log(authData); browserHistory.push('/favorites'); } }); }
app.post('/login', function (req, res) { ref.authWithPassword({ email : req.body.email, password : req.body.password }, function(error, authData) { if (error) { console.log('error'); res.render('index.jade', {apiKey: config.googleMapsApiKey, firebaseUrl: config.firebaseUrl}); } else { req.session.user = authData; res.redirect('/home'); } }); });
handleSubmit: function(event) { event.preventDefault(); userRef.authWithPassword({ email: this.refs.email.value, password: this.refs.password.value, }, (error, authData) => { if(error) { console.log('Login Failed.', error); } else { console.log('Login success.'); var currentuser = userRef.getAuth().uid; userInfo.on('value', (snapshot) => { this.setState({user: snapshot.val()[currentuser]}); }); } }) this.refs.loginform.reset(); },
window.authUser = function(){ var emailHTML = document.getElementById("email-input").value; //string var passwordHTML = document.getElementById("password-input").value; //string ref.authWithPassword({ email : emailHTML, password : passwordHTML }, function(error, authData) { if (error) { console.log("Login Failed!", error); } else { console.log("Authenticated successfully with payload:", authData); localStorage.setItem("uid", authData.uid); if (localStorage.getItem("uid") != null){ window.location.assign("./student-projects.html"); } } }); };
handleSignin(){ ref.authWithPassword({ email: this.state.email, password: this.state.password }, (error, authData) =>{ if (error) { console.log('Login Failed!', error) Alert.alert("Incorrect Email or Password!") } else { this.props.navigator.resetTo({ component: Dashboard, }) } } ) this.setState({ isLoading: true, }); }
var signIn = function(request, response) { var username = request.body.username; var password = request.body.password; ref.authWithPassword({ email: username, password: password }, function(error, authData) { if (error) { console.log("Login Failed!", error); response.status(401).send({error: "Login Failed"}); } else { request.session.token = authData.token; // Save the username to the session request.session.username = username; response.send(true); } }); };
handleSignin(){ ref.authWithPassword({ email: this.state.email, password: this.state.password }, (error, authData) =>{ if (error) { console.log('Login Failed!', error) alert('Invalid login credentials, Please try again'); this.setState({ isLoading: true, }); } else { this.apiRequest(); } } ); }