Guest User

Untitled

a guest
Feb 8th, 2019
783
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. data=request.get_json(force=True)
  2. email=request.get_json()["email"]
  3. password=request.get_json()['password']
  4. try:
  5. auth.create_user_with_email_and_password(email,password)
  6. except:
  7. userexists="User Already Exists"
  8. try:
  9. user=auth.sign_in_with_email_and_password(email,password)
  10. id = auth.get_account_info(user['idToken'])
  11. db.child("users").push(id)
  12. except:
  13. invalidCredentials="Wrong Credentials"
  14. if request.get_json(force=True):
  15. x={
  16. "name":"sarmad",
  17. "roll":"052"
  18. }
  19. s=json.dumps(x)
  20. return s
  21. else:
  22. return ""
  23.  
  24. fetch('http://127.0.0.1:5000/adduser', {
  25. mode:'no-cors',
  26. method: 'POST',
  27. headers: {
  28. 'Accept': 'application/json',
  29. "Access-Control-Allow-Origin": "*",
  30. 'Content-Type': 'application/json'
  31. },
  32. body: JSON.stringify({
  33. 'email': this.state.email,
  34. password: this.state.password,
  35. name: this.state.name,
  36. // userType: userTy,
  37. dob:this.state.DOB,
  38. address:this.state.Address,
  39. gender:'male',
  40. phone:'090078601',
  41. // roles:roles
  42. })
  43. }).then((response) => response).then((responseJson) => {
  44. console.log(responseJson);
  45. //this.setState({pressed: false});
  46. })
Add Comment
Please, Sign In to add comment