aboutsummaryrefslogtreecommitdiff
path: root/public/js/auth.js
diff options
context:
space:
mode:
authorPitu <[email protected]>2017-01-30 04:41:44 -0300
committerPitu <[email protected]>2017-01-30 04:41:44 -0300
commitb781237454e7db4c5cd5395c0198fe9c384751ca (patch)
tree93fd1b6c641472d0cdf6b5d9a4009827c737fbb8 /public/js/auth.js
parentMade passwords behave like passwords (diff)
downloadhost.fuwn.me-b781237454e7db4c5cd5395c0198fe9c384751ca.tar.xz
host.fuwn.me-b781237454e7db4c5cd5395c0198fe9c384751ca.zip
Replaced auth header with token
Diffstat (limited to 'public/js/auth.js')
-rw-r--r--public/js/auth.js50
1 files changed, 25 insertions, 25 deletions
diff --git a/public/js/auth.js b/public/js/auth.js
index 9013298..68cf9e3 100644
--- a/public/js/auth.js
+++ b/public/js/auth.js
@@ -14,19 +14,19 @@ page.do = function(dest){
username: user,
password: pass
})
- .then(function (response) {
-
- if(response.data.success === false)
- return swal('Error', response.data.description, 'error');
-
- localStorage.token = response.data.token;
- window.location('/panel');
-
- })
- .catch(function (error) {
- return swal('An error ocurred', 'There was an error with the request, please check the console for more information.', 'error');
- console.log(error);
- });
+ .then(function (response) {
+
+ if(response.data.success === false)
+ return swal('Error', response.data.description, 'error');
+
+ localStorage.token = response.data.token;
+ window.location = '/panel';
+
+ })
+ .catch(function (error) {
+ return swal('An error ocurred', 'There was an error with the request, please check the console for more information.', 'error');
+ console.log(error);
+ });
}
page.verify = function(){
@@ -36,18 +36,18 @@ page.verify = function(){
axios.post('/api/tokens/verify', {
token: page.token
})
- .then(function (response) {
-
- if(response.data.success === false)
- return swal('Error', response.data.description, 'error');
-
- window.location('/panel');
-
- })
- .catch(function (error) {
- return swal('An error ocurred', 'There was an error with the request, please check the console for more information.', 'error');
- console.log(error);
- });
+ .then(function (response) {
+
+ if(response.data.success === false)
+ return swal('Error', response.data.description, 'error');
+
+ window.location = '/panel';
+
+ })
+ .catch(function (error) {
+ return swal('An error ocurred', 'There was an error with the request, please check the console for more information.', 'error');
+ console.log(error);
+ });
}