Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //log a user in with a username/password
- login: function(username, password) {
- return self.$http.post(envConfig.auth.login, { username: username, password: password })
- .then(setupUser)
- .catch(function(resp) {
- if (angular.isString(resp)) {
- return $q.reject(resp);
- }
- if (resp.status === 401) {
- return $q.reject('bad-password');
- }
- var msg = utilityService.stringFormat('<p>Service Error: {0} </p><p> Status Code: {1} </p><p> URL: {2}</p>',
- (resp.data || {}).error || 'Unknown',
- resp.status,
- resp.config.url
- );
- aaNotify.danger(msg,
- { iconClass: 'zmdi zmdi-mood-bad zmdi-hc-5x', ttl: 0, allowHtml: true, showClose: true });
- return $q.reject(resp);
- });
- },
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement