Advertisement
Guest User

Untitled

a guest
Nov 9th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. import Ember from 'ember';
  2.  
  3. export default Ember.Controller.extend({
  4. firebaseApp: Ember.inject.service(),
  5.  
  6. actions: {
  7. signUp() {
  8. const auth = this.get('firebaseApp').auth();
  9. const email = this.get('email');
  10. const pass = this.get('password');
  11.  
  12. auth.createUserWithEmailAndPassword(email, pass).then((userResponse) => {
  13. console.log('in createUserWithEmailAndPassword function');
  14. const user = this.store.createRecord('user', {
  15. id: userResponse.uid,
  16. email: userResponse.email,
  17. });
  18. return user.save();
  19. });
  20. }
  21. }
  22. });
  23.  
  24. {{#if session.isAuthenticated}}
  25. <small style="color: white;">Logged in as {{session.currentUser.email}}</small>
  26. <button {{action "signOut"}} class="btn btn-success">Sign out</button>
  27. {{/if}}
  28.  
  29. import Ember from 'ember';
  30.  
  31. export default Ember.Component.extend({
  32. session: Ember.inject.service('session'),
  33.  
  34. actions: {
  35. signOut() {
  36. this.get('signOut')();
  37. }
  38. }
  39. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement