mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
Add Google Signin (#7969)
* Start adding google login * fix local js issue * implement syntax suggestions * fix delete social tests * Add service for authentication alerts * fix social login tests * make suggested google sign in changes * fix accidentally deleted code * refactor social network sign in * fix incorrect find * implement suggested google sign in changes * fix(tests): Inject fake Auth module for auth controller * fix(test): prevent social service from causing page reload * fix loading user info * Use lodash's implimentation of find for IE compatibility * chore: increase test coverage around deletion route * chore: clean up social auth test * chore: Fix social login tests * remove profile from login scope * fix(api): Allow social accounts to deregister as user has auth backup * temporarily disable google login button
This commit is contained in:
committed by
Matteo Pagliazzi
parent
941000d737
commit
e3b484b29a
32
website/client-old/js/services/alertServices.js
Normal file
32
website/client-old/js/services/alertServices.js
Normal file
@@ -0,0 +1,32 @@
|
||||
'use strict';
|
||||
|
||||
(function(){
|
||||
angular
|
||||
.module('habitrpg')
|
||||
.factory('Alert', alertFactory);
|
||||
|
||||
alertFactory.$inject = [
|
||||
'$window'
|
||||
];
|
||||
|
||||
function alertFactory($window) {
|
||||
|
||||
function authErrorAlert(data, status, headers, config) {
|
||||
if (status === 0) {
|
||||
$window.alert(window.env.t('noReachServer'));
|
||||
} else if (status === 400 && data.errors && _.isArray(data.errors)) { // bad requests
|
||||
data.errors.forEach(function (err) {
|
||||
$window.alert(err.message);
|
||||
});
|
||||
} else if (!!data && !!data.error) {
|
||||
$window.alert(data.message);
|
||||
} else {
|
||||
$window.alert(window.env.t('errorUpCase') + ' ' + status);
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
authErrorAlert: authErrorAlert,
|
||||
}
|
||||
}
|
||||
}());
|
||||
Reference in New Issue
Block a user