Advertisement
Guest User

Untitled

a guest
Sep 4th, 2016
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. angular.module('ocrewingApiApp')
  2. .factory('auth_provider', [
  3. '$auth',
  4. function ($auth) {
  5. var o = {
  6. user: {},
  7. config: {}
  8. };
  9.  
  10. o.login = function(auth, config) {
  11. angular.copy(config, o.config);
  12. return $auth.submitLogin(auth, config);
  13. };
  14.  
  15. o.register = function(auth, config) {
  16. angular.copy(config, o.config);
  17. return $auth.submitRegistration(auth, config);
  18. };
  19.  
  20. o.signOut = function() {
  21. return $auth.signOut();
  22. };
  23.  
  24. o.validateUser = function(config) {
  25. angular.copy(config, o.config);
  26.  
  27. console.log(o.config);
  28.  
  29. return $auth.validateUser(o.config).then(function(resp){
  30. angular.copy(resp, o.user);
  31. });
  32. };
  33.  
  34. o.requestPasswordReset = function(data) {
  35. return $auth.requestPasswordReset(data);
  36. };
  37.  
  38. o.updatePassword = function(data) {
  39. return $auth.updatePassword(data);
  40. };
  41.  
  42. o.updateAccount = function(data, config){
  43. return $auth.updateAccount(data, config);
  44. };
  45.  
  46. return o;
  47. }]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement