Login if user exist
This commit is contained in:
parent
38afecced9
commit
3592ba57bc
130
package-lock.json
generated
130
package-lock.json
generated
@ -430,9 +430,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@angular/fire": {
|
"@angular/fire": {
|
||||||
"version": "5.1.3",
|
"version": "5.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/@angular/fire/-/fire-5.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/@angular/fire/-/fire-5.2.1.tgz",
|
||||||
"integrity": "sha512-s9tdSDS0ZLWKax5atMSxpJWehQ59bKgbzy8uZJVo1vyJw/eshBduuCZbETBj6RmwWhKgrBfgS2odNwKxArE25w=="
|
"integrity": "sha512-pS4zWhLLANzMbYVIKNtebDQKhm9+KANUDvDV6DwKP24XHzkZdvazKe1HC6uXWlf7QmDxSPFleCSBkn0tnQQzdQ=="
|
||||||
},
|
},
|
||||||
"@angular/flex-layout": {
|
"@angular/flex-layout": {
|
||||||
"version": "7.0.0-beta.24",
|
"version": "7.0.0-beta.24",
|
||||||
@ -649,13 +649,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@firebase/app": {
|
"@firebase/app": {
|
||||||
"version": "0.4.1",
|
"version": "0.4.3",
|
||||||
"resolved": "https://registry.npmjs.org/@firebase/app/-/app-0.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/@firebase/app/-/app-0.4.3.tgz",
|
||||||
"integrity": "sha512-NHzEMPXWRXmDMMhFbCqElOkoVo5mScw81KzhqiEkU7e0v1Ia0P0fztfwqIzawvJtYW158UFSU7Q+EbpzthImqQ==",
|
"integrity": "sha512-UB/CLBU9ONA0m9ajPJHtHHSl/6nNQfQ0wvnpTuHFuy7e/0jeKIuBeE+18DGyCBetv20T1/1EXDtv8YF3KISong==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@firebase/app-types": "0.4.0",
|
"@firebase/app-types": "0.4.0",
|
||||||
"@firebase/logger": "0.1.14",
|
"@firebase/logger": "0.1.14",
|
||||||
"@firebase/util": "0.2.15",
|
"@firebase/util": "0.2.17",
|
||||||
"dom-storage": "2.1.0",
|
"dom-storage": "2.1.0",
|
||||||
"tslib": "1.9.3",
|
"tslib": "1.9.3",
|
||||||
"xmlhttprequest": "1.8.0"
|
"xmlhttprequest": "1.8.0"
|
||||||
@ -680,13 +680,13 @@
|
|||||||
"integrity": "sha512-QEG9azYwssGWcb4NaKFHe3Piez0SG46nRlu76HM4/ob0sjjNpNTY1Z5C3IoeJYknp2kMzuQi0TTW8tjEgkUAUA=="
|
"integrity": "sha512-QEG9azYwssGWcb4NaKFHe3Piez0SG46nRlu76HM4/ob0sjjNpNTY1Z5C3IoeJYknp2kMzuQi0TTW8tjEgkUAUA=="
|
||||||
},
|
},
|
||||||
"@firebase/database": {
|
"@firebase/database": {
|
||||||
"version": "0.4.1",
|
"version": "0.4.3",
|
||||||
"resolved": "https://registry.npmjs.org/@firebase/database/-/database-0.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/@firebase/database/-/database-0.4.3.tgz",
|
||||||
"integrity": "sha512-3hCq5m1JOvg037Yci471LA+1B7PnmiZDiwztNZ9a2U7t28VXGXkf4ECriG7UyxWoR6yTFWUUQeaBTr4SJ78fhA==",
|
"integrity": "sha512-dJm76D/+L5o0h61B1CoM039/h2SxppvbKV9HbDKo4JsGbN2FOru27XXC3/JLWauILq38bxk95vzIpMqlPWcDSw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@firebase/database-types": "0.4.0",
|
"@firebase/database-types": "0.4.0",
|
||||||
"@firebase/logger": "0.1.14",
|
"@firebase/logger": "0.1.14",
|
||||||
"@firebase/util": "0.2.15",
|
"@firebase/util": "0.2.17",
|
||||||
"faye-websocket": "0.11.1",
|
"faye-websocket": "0.11.1",
|
||||||
"tslib": "1.9.3"
|
"tslib": "1.9.3"
|
||||||
},
|
},
|
||||||
@ -707,9 +707,9 @@
|
|||||||
"integrity": "sha512-2piRYW7t+2s/P1NPpcI/3+8Y5l2WnJhm9KACoXW5zmoAPlya8R1aEaR2dNHLNePTMHdg04miEDD9fEz4xUqzZA=="
|
"integrity": "sha512-2piRYW7t+2s/P1NPpcI/3+8Y5l2WnJhm9KACoXW5zmoAPlya8R1aEaR2dNHLNePTMHdg04miEDD9fEz4xUqzZA=="
|
||||||
},
|
},
|
||||||
"@firebase/firestore": {
|
"@firebase/firestore": {
|
||||||
"version": "1.3.1",
|
"version": "1.3.4",
|
||||||
"resolved": "https://registry.npmjs.org/@firebase/firestore/-/firestore-1.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/@firebase/firestore/-/firestore-1.3.4.tgz",
|
||||||
"integrity": "sha512-cr7qpGIphewqB4uMi/JeXFaHaqA+v0VeHRkTn/f8LC4npQgbq9r1yOumQpcJEJH0POfkMGZjVdpb+knzjM8qUQ==",
|
"integrity": "sha512-qETQ+vTVrTmP66fI8RFvfGLp+xFzgXWqR5IXuSWtF4+xk69gMImE6KkT2KnpzEbpu2AqZ2JFko/lXsk5OtQDbA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@firebase/firestore-types": "1.3.0",
|
"@firebase/firestore-types": "1.3.0",
|
||||||
"@firebase/logger": "0.1.14",
|
"@firebase/logger": "0.1.14",
|
||||||
@ -725,12 +725,12 @@
|
|||||||
"integrity": "sha512-XPnfAaYsKgYivgl/U1+M5ulBG9Hxv52zrZR5TuaoKCU791t/E3K85rT1ZGtEHu9Fj4CPTep2NSl8I30MQpUlHA=="
|
"integrity": "sha512-XPnfAaYsKgYivgl/U1+M5ulBG9Hxv52zrZR5TuaoKCU791t/E3K85rT1ZGtEHu9Fj4CPTep2NSl8I30MQpUlHA=="
|
||||||
},
|
},
|
||||||
"@firebase/functions": {
|
"@firebase/functions": {
|
||||||
"version": "0.4.7",
|
"version": "0.4.8",
|
||||||
"resolved": "https://registry.npmjs.org/@firebase/functions/-/functions-0.4.7.tgz",
|
"resolved": "https://registry.npmjs.org/@firebase/functions/-/functions-0.4.8.tgz",
|
||||||
"integrity": "sha512-k0Rn2c1Nsb90Qwk9O2JCSPoH6ozxyp0WZgIPU2OoLzYrrg+fVdcEnG3Sb1YhlOU5yRA9Nuxh1pPBQA3/e/A98g==",
|
"integrity": "sha512-b/56f5ThflgyL3Hmd7ifKBYRbrr97MRMVHr1WTvHKM/Dg5K7yWO219mG8Er9z4PuRQh2aulfJ1KQD6X7d+Aqfg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@firebase/functions-types": "0.3.5",
|
"@firebase/functions-types": "0.3.5",
|
||||||
"@firebase/messaging-types": "0.2.11",
|
"@firebase/messaging-types": "0.3.0",
|
||||||
"isomorphic-fetch": "2.2.1",
|
"isomorphic-fetch": "2.2.1",
|
||||||
"tslib": "1.9.3"
|
"tslib": "1.9.3"
|
||||||
}
|
}
|
||||||
@ -741,19 +741,20 @@
|
|||||||
"integrity": "sha512-3hTMqfSugCfxzT6vZPbzQ58G4941rsFr99fWKXGKFAl2QpdMBCnKmEKdg/p5M47xIPyzIQn6NMF5kCo/eICXhA=="
|
"integrity": "sha512-3hTMqfSugCfxzT6vZPbzQ58G4941rsFr99fWKXGKFAl2QpdMBCnKmEKdg/p5M47xIPyzIQn6NMF5kCo/eICXhA=="
|
||||||
},
|
},
|
||||||
"@firebase/installations": {
|
"@firebase/installations": {
|
||||||
"version": "0.1.1",
|
"version": "0.1.4",
|
||||||
"resolved": "https://registry.npmjs.org/@firebase/installations/-/installations-0.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/@firebase/installations/-/installations-0.1.4.tgz",
|
||||||
"integrity": "sha512-7qg0iSYs/XhvfXF8m8fMc44ViEPbaTpKpvD6A6bN3VUjaTg+un7bROEGtfP8xboTbqdN80gjiKnHI+Ibs5KxCw==",
|
"integrity": "sha512-0yKKEXCtciBTe41hF77Q1aY5IB4QjohlupRRLHqw0CQQUZ2L94halNLqtw8iptltc2IHPSH68HGXlFTSdmJlHQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@firebase/installations-types": "0.1.0",
|
"@firebase/installations-types": "0.1.1",
|
||||||
"@firebase/util": "0.2.15",
|
"@firebase/util": "0.2.17",
|
||||||
"idb": "3.0.2"
|
"idb": "3.0.2",
|
||||||
|
"tslib": "1.9.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@firebase/installations-types": {
|
"@firebase/installations-types": {
|
||||||
"version": "0.1.0",
|
"version": "0.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/@firebase/installations-types/-/installations-types-0.1.0.tgz",
|
"resolved": "https://registry.npmjs.org/@firebase/installations-types/-/installations-types-0.1.1.tgz",
|
||||||
"integrity": "sha512-cw2UIvPa3+umy6w7dGj0LqQQ9v7WEOro5s+6B+v54Tw25WyLnR6cBIkyyahv3Uu9QPnGZCIsemlQwxIaIOMb9g=="
|
"integrity": "sha512-M+plQIOt6p+/j/ExUgsfXe1JFAKymhBU0K3+cp7hzj52vLSpklOqNJi4LkFl41pgRFPZeKf7MrTkMhVowg3Ukw=="
|
||||||
},
|
},
|
||||||
"@firebase/logger": {
|
"@firebase/logger": {
|
||||||
"version": "0.1.14",
|
"version": "0.1.14",
|
||||||
@ -761,29 +762,29 @@
|
|||||||
"integrity": "sha512-WREaY2n6HzypeoovOjYefjLJqT9+zlI1wQlLMXnkSPhwuM+udIQ87orjVL6tfmuHW++u5bZh3JJAyvuRv/nciA=="
|
"integrity": "sha512-WREaY2n6HzypeoovOjYefjLJqT9+zlI1wQlLMXnkSPhwuM+udIQ87orjVL6tfmuHW++u5bZh3JJAyvuRv/nciA=="
|
||||||
},
|
},
|
||||||
"@firebase/messaging": {
|
"@firebase/messaging": {
|
||||||
"version": "0.3.20",
|
"version": "0.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@firebase/messaging/-/messaging-0.3.20.tgz",
|
"resolved": "https://registry.npmjs.org/@firebase/messaging/-/messaging-0.4.0.tgz",
|
||||||
"integrity": "sha512-0mJpaSFoineVFnaYTHVP4k/PANEEmZhES9fPd44Ir6b9mR4FhJip5ojZl0vlyMe5rZWCLuxYkfFcyzEn2afNKw==",
|
"integrity": "sha512-wi4t7i4VjYkXF9CBd9iL3gUe+DvhZbbmhuYzopBL3sWxKTVWmOG8W4WapYKgx9RyluscZqAZJbL3YtpUtqcKkw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@firebase/messaging-types": "0.2.11",
|
"@firebase/messaging-types": "0.3.0",
|
||||||
"@firebase/util": "0.2.15",
|
"@firebase/util": "0.2.17",
|
||||||
"tslib": "1.9.3"
|
"tslib": "1.9.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@firebase/messaging-types": {
|
"@firebase/messaging-types": {
|
||||||
"version": "0.2.11",
|
"version": "0.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/@firebase/messaging-types/-/messaging-types-0.2.11.tgz",
|
"resolved": "https://registry.npmjs.org/@firebase/messaging-types/-/messaging-types-0.3.0.tgz",
|
||||||
"integrity": "sha512-uWtzPMj1mAX8EbG68SnxE12Waz+hRuO7vtosUFePGBfxVNNmPx5vJyKZTz+hbM4P77XddshAiaEkyduro4gNgA=="
|
"integrity": "sha512-xCFMPy4C+WXFcshTnQEyddmqM6ZkzpTeJq7RUhrAvUnjlfFzOB92HOfKtjT6IpNk5W+jNbTTrqgrgReuPXsM2A=="
|
||||||
},
|
},
|
||||||
"@firebase/performance": {
|
"@firebase/performance": {
|
||||||
"version": "0.2.2",
|
"version": "0.2.5",
|
||||||
"resolved": "https://registry.npmjs.org/@firebase/performance/-/performance-0.2.2.tgz",
|
"resolved": "https://registry.npmjs.org/@firebase/performance/-/performance-0.2.5.tgz",
|
||||||
"integrity": "sha512-wpH9Nac8CadEfyrr8u8QQO+HfQ7ndkrOSesXDtIbbVOify9A2sCdwWuIWPxMAclevgSp99zVj2yjd7sv6M3jVQ==",
|
"integrity": "sha512-9uN7kKAMMEWcO6mW2+JIAi8SUuAmS6QuVje623mnS/OE/oT/Fy43TsZI2yxq8wmQEj8i871vSPvA1ff6Kze1sg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@firebase/installations": "0.1.1",
|
"@firebase/installations": "0.1.4",
|
||||||
"@firebase/logger": "0.1.14",
|
"@firebase/logger": "0.1.14",
|
||||||
"@firebase/performance-types": "0.0.1",
|
"@firebase/performance-types": "0.0.1",
|
||||||
"@firebase/util": "0.2.15",
|
"@firebase/util": "0.2.17",
|
||||||
"tslib": "1.9.3"
|
"tslib": "1.9.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -815,23 +816,23 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@firebase/storage": {
|
"@firebase/storage": {
|
||||||
"version": "0.2.16",
|
"version": "0.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/@firebase/storage/-/storage-0.2.16.tgz",
|
"resolved": "https://registry.npmjs.org/@firebase/storage/-/storage-0.3.0.tgz",
|
||||||
"integrity": "sha512-R/qLIqp7ht7T0P2w3LWB5JvXUZMCWzrHOyublAa4iSVcuqN2SLMIpqnYXNKYk+o/NcW7jO8DE8c62mnpvsS+pw==",
|
"integrity": "sha512-PnUvTIVHUskLuD9pO3pQ/NQPYpbq/uUOMuYCmPmW28/vRO+T0lCpwIu9zpuRtOLegmbePiFj2XXfrfA8p23Frw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@firebase/storage-types": "0.2.11",
|
"@firebase/storage-types": "0.3.0",
|
||||||
"tslib": "1.9.3"
|
"tslib": "1.9.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@firebase/storage-types": {
|
"@firebase/storage-types": {
|
||||||
"version": "0.2.11",
|
"version": "0.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/@firebase/storage-types/-/storage-types-0.2.11.tgz",
|
"resolved": "https://registry.npmjs.org/@firebase/storage-types/-/storage-types-0.3.0.tgz",
|
||||||
"integrity": "sha512-vGTFJmKbfScmCAVUamREIBTopr5Uusxd8xPAgNDxMZwICvdCjHO0UH0pZZj6iBQuwxLe/NEtFycPnu1kKT+TPw=="
|
"integrity": "sha512-zy24QU3xPXIOIAussB51fLID9F7j5NttKbs+3SqhKexU8kmNdwi1Lg91acSBuR1Oa/T8RRk5El9Jtd4dlTXjyQ=="
|
||||||
},
|
},
|
||||||
"@firebase/util": {
|
"@firebase/util": {
|
||||||
"version": "0.2.15",
|
"version": "0.2.17",
|
||||||
"resolved": "https://registry.npmjs.org/@firebase/util/-/util-0.2.15.tgz",
|
"resolved": "https://registry.npmjs.org/@firebase/util/-/util-0.2.17.tgz",
|
||||||
"integrity": "sha512-XA6C4HkBOcUfDyvp/clq0MCFSuWSm3bPkolP689RCrGzjBs+bnCzC5a7by6Fq106zAQYeASwULJjTfVtZjKaaQ==",
|
"integrity": "sha512-RvHkhQUkihI4JafJmB7S7Q8qVDFPD+kQdSmUyVTR2sEzxkk92MsIq4dBYnSjOMmnCe7L5lmB6hJdzkHa/TAP5A==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"tslib": "1.9.3"
|
"tslib": "1.9.3"
|
||||||
}
|
}
|
||||||
@ -3765,19 +3766,22 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"firebase": {
|
"firebase": {
|
||||||
"version": "6.0.2",
|
"version": "6.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/firebase/-/firebase-6.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/firebase/-/firebase-6.1.0.tgz",
|
||||||
"integrity": "sha512-KA4VviZQJCzCIkCEvt3sJEsNe/HpqQdNE+ajy3wELHCxNV8PK8eBa10qxWDQhNgEtorHHltgYw3VwS0rbSvWrQ==",
|
"integrity": "sha512-ewWFdhqI2vkOS7ij6U/tC5T4vwGeT0kiI3cs4LerrxQnMT+PMcl8RTeyvFwXf7nk6ExFr5dkrEeef6uKSqImPw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@firebase/app": "0.4.1",
|
"@firebase/app": "0.4.3",
|
||||||
|
"@firebase/app-types": "0.4.0",
|
||||||
"@firebase/auth": "0.11.2",
|
"@firebase/auth": "0.11.2",
|
||||||
"@firebase/database": "0.4.1",
|
"@firebase/database": "0.4.3",
|
||||||
"@firebase/firestore": "1.3.1",
|
"@firebase/firestore": "1.3.4",
|
||||||
"@firebase/functions": "0.4.7",
|
"@firebase/functions": "0.4.8",
|
||||||
"@firebase/messaging": "0.3.20",
|
"@firebase/installations": "0.1.4",
|
||||||
"@firebase/performance": "0.2.2",
|
"@firebase/messaging": "0.4.0",
|
||||||
|
"@firebase/performance": "0.2.5",
|
||||||
"@firebase/polyfill": "0.3.14",
|
"@firebase/polyfill": "0.3.14",
|
||||||
"@firebase/storage": "0.2.16"
|
"@firebase/storage": "0.3.0",
|
||||||
|
"@firebase/util": "0.2.17"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flatted": {
|
"flatted": {
|
||||||
@ -8189,9 +8193,9 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "10.14.7",
|
"version": "10.14.8",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.7.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.8.tgz",
|
||||||
"integrity": "sha512-on4MmIDgHXiuJDELPk1NFaKVUxxCFr37tm8E9yN6rAiF5Pzp/9bBfBHkoexqRiY+hk/Z04EJU9kKEb59YqJ82A=="
|
"integrity": "sha512-I4+DbJEhLEg4/vIy/2gkWDvXBOOtPKV9EnLhYjMoqxcRW+TTZtUftkHktz/a8suoD5mUL7m6ReLrkPvSsCQQmw=="
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
"@angular/common": "~7.2.0",
|
"@angular/common": "~7.2.0",
|
||||||
"@angular/compiler": "~7.2.0",
|
"@angular/compiler": "~7.2.0",
|
||||||
"@angular/core": "~7.2.0",
|
"@angular/core": "~7.2.0",
|
||||||
"@angular/fire": "^5.1.3",
|
"@angular/fire": "^5.2.1",
|
||||||
"@angular/flex-layout": "^7.0.0-beta.24",
|
"@angular/flex-layout": "^7.0.0-beta.24",
|
||||||
"@angular/forms": "~7.2.0",
|
"@angular/forms": "~7.2.0",
|
||||||
"@angular/material": "^7.3.7",
|
"@angular/material": "^7.3.7",
|
||||||
@ -25,8 +25,7 @@
|
|||||||
"@angular/platform-browser-dynamic": "~7.2.0",
|
"@angular/platform-browser-dynamic": "~7.2.0",
|
||||||
"@angular/router": "~7.2.0",
|
"@angular/router": "~7.2.0",
|
||||||
"core-js": "^2.5.4",
|
"core-js": "^2.5.4",
|
||||||
"firebase": "^6.0.2",
|
"firebase": "^6.1.0",
|
||||||
"g": "^2.0.1",
|
|
||||||
"hammerjs": "^2.0.8",
|
"hammerjs": "^2.0.8",
|
||||||
"moment": "^2.24.0",
|
"moment": "^2.24.0",
|
||||||
"rxjs": "~6.3.3",
|
"rxjs": "~6.3.3",
|
||||||
|
@ -10,6 +10,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|||||||
import { AppRoutingModule } from '@app/app-routing.module';
|
import { AppRoutingModule } from '@app/app-routing.module';
|
||||||
import { AngularFireModule } from '@angular/fire';
|
import { AngularFireModule } from '@angular/fire';
|
||||||
import { AngularFireDatabaseModule } from '@angular/fire/database';
|
import { AngularFireDatabaseModule } from '@angular/fire/database';
|
||||||
|
import { AngularFireAuthModule } from "@angular/fire/auth";
|
||||||
import { AppMaterialModule } from '@app/app-material.module';
|
import { AppMaterialModule } from '@app/app-material.module';
|
||||||
|
|
||||||
import { LogService, SEOService } from '@app/core/services';
|
import { LogService, SEOService } from '@app/core/services';
|
||||||
@ -31,6 +32,7 @@ import { CardDashboardComponent } from './card-dashboard/card-dashboard.componen
|
|||||||
BrowserAnimationsModule,
|
BrowserAnimationsModule,
|
||||||
AppRoutingModule,
|
AppRoutingModule,
|
||||||
AngularFireModule.initializeApp( environment.firebaseConfig ),
|
AngularFireModule.initializeApp( environment.firebaseConfig ),
|
||||||
|
AngularFireAuthModule,
|
||||||
AngularFireDatabaseModule,
|
AngularFireDatabaseModule,
|
||||||
AppMaterialModule,
|
AppMaterialModule,
|
||||||
],
|
],
|
||||||
|
@ -18,7 +18,7 @@ export class AuthGuard implements CanActivate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// not logged in so redirect to login page with the return url
|
// not logged in so redirect to login page with the return url
|
||||||
this.router.navigate( [ '/login' ], { queryParams: { returnUrl: state.url } } );
|
this.router.navigate( [ '/register' ], { queryParams: { returnUrl: state.url } } );
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,9 @@ import { Injectable } from '@angular/core';
|
|||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { BehaviorSubject, Observable } from 'rxjs';
|
import { BehaviorSubject, Observable } from 'rxjs';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { User } from '@app/core/model';
|
import { auth } from 'firebase/app';
|
||||||
|
import { AngularFireAuth } from "@angular/fire/auth";
|
||||||
|
import { User } from 'firebase';
|
||||||
import { StorageService } from '@app/core/services/storage/storage.service';
|
import { StorageService } from '@app/core/services/storage/storage.service';
|
||||||
import { LogService } from '@app/core/services/log/log.service';
|
import { LogService } from '@app/core/services/log/log.service';
|
||||||
|
|
||||||
@ -10,14 +12,38 @@ import { LogService } from '@app/core/services/log/log.service';
|
|||||||
|
|
||||||
@Injectable( { providedIn: 'root' } )
|
@Injectable( { providedIn: 'root' } )
|
||||||
export class AuthService {
|
export class AuthService {
|
||||||
|
user: User;
|
||||||
|
|
||||||
public currentUser: Observable<User>;
|
constructor(public afAuth: AngularFireAuth, public router: Router) {
|
||||||
// public emailRegex = new RegExp( );
|
this.afAuth.authState.subscribe(user => {
|
||||||
private currentUserSubject: BehaviorSubject<User>;
|
if (user) {
|
||||||
|
this.user = user;
|
||||||
|
localStorage.setItem('user', JSON.stringify(this.user));
|
||||||
|
} else {
|
||||||
|
localStorage.setItem('user', null);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
constructor( private http: HttpClient, private router: Router, private stor: StorageService, private looger: LogService ) {
|
async login(email: string, password: string) {
|
||||||
this.currentUserSubject = new BehaviorSubject<User>( stor.getLocal( 'user' ) as User );
|
|
||||||
this.currentUser = this.currentUserSubject.asObservable();
|
try {
|
||||||
|
await this.afAuth.auth.signInWithEmailAndPassword(email, password)
|
||||||
|
this.router.navigate(['register/list']);
|
||||||
|
} catch (e) {
|
||||||
|
alert("Error!" + e.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async logout(){
|
||||||
|
await this.afAuth.auth.signOut();
|
||||||
|
localStorage.removeItem('user');
|
||||||
|
this.router.navigate(['/register']);
|
||||||
|
}
|
||||||
|
|
||||||
|
get isLoggedIn(): boolean {
|
||||||
|
const user = JSON.parse(localStorage.getItem('user'));
|
||||||
|
return user !== null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get currentUserValue(): User {
|
public get currentUserValue(): User {
|
||||||
@ -34,55 +60,6 @@ export class AuthService {
|
|||||||
// }
|
// }
|
||||||
// } );
|
// } );
|
||||||
// }
|
// }
|
||||||
return this.currentUserSubject.value;
|
return //this.currentUserSubject.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public login( username: string, password: string ): any {
|
|
||||||
// const data: FormData = new FormData();
|
|
||||||
|
|
||||||
// data.append( 'email', username );
|
|
||||||
// data.append( 'password', sha512.sha512( password ) );
|
|
||||||
|
|
||||||
// return this.http.post<any>( environment.baseUrl + config.url.auth, data )
|
|
||||||
// .pipe( map( result => {
|
|
||||||
// let user = new User();
|
|
||||||
//
|
|
||||||
// this.looger.logInfo( result );
|
|
||||||
// // login successful if there's a jwt token in the response
|
|
||||||
// if ( result && result.body && result.statusCode === 200 ) {
|
|
||||||
//
|
|
||||||
// user.token = result.body;
|
|
||||||
// user.timeGetToken = new Date().getTime();
|
|
||||||
//
|
|
||||||
// // store user details and jwt token in local storage to keep user logged in between page refreshes
|
|
||||||
// this.stor.setLocal( 'user', user );
|
|
||||||
// this.currentUserSubject.next( user );
|
|
||||||
// } else {
|
|
||||||
// user = result.statusCode;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return user;
|
|
||||||
// } ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
public logout(): void {
|
|
||||||
// remove user from local storage to log user out
|
|
||||||
// this.stor.setLocal( 'user' );
|
|
||||||
// this.currentUserSubject.next( null );
|
|
||||||
// this.router.navigate( [ '/login' ] );
|
|
||||||
}
|
|
||||||
|
|
||||||
public createAccount( email: string, password: string, repeat: string ): any {
|
|
||||||
// const data: FormData = new FormData();
|
|
||||||
|
|
||||||
// if ( password === repeat && this.emailRegex.test( email ) ) {
|
|
||||||
// data.append( 'email', email );
|
|
||||||
// data.append( 'password', sha512.sha512( password ) );
|
|
||||||
|
|
||||||
// return this.http.post( environment.baseUrl + config.url.register, data );
|
|
||||||
// }
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
<header>
|
<header>
|
||||||
|
|
||||||
<div id="header-container-desktop" fxLayout="row" fxLayoutAlign="space-between" fxShow
|
<div id="header-container-desktop" fxLayout="row" fxLayoutAlign="space-between" fxShow fxHide.lt-md="true">
|
||||||
fxHide.lt-md="true">
|
|
||||||
|
|
||||||
<div fxFlex="200px" class="title">
|
<div fxFlex="200px" class="title">
|
||||||
<a [routerLink]="">DiscoTrip</a>
|
<a [routerLink]="">DiscoTrip</a>
|
||||||
@ -18,6 +17,9 @@
|
|||||||
<button mat-fab class="account-button">
|
<button mat-fab class="account-button">
|
||||||
<mat-icon>person</mat-icon>
|
<mat-icon>person</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
|
<li *ngIf="authService.isLoggedIn" class="nav-item">
|
||||||
|
<a class="nav-link" (click)="authService.logout()">Logout</a>
|
||||||
|
</li>
|
||||||
</div>
|
</div>
|
||||||
<div fxFlex="50px">
|
<div fxFlex="50px">
|
||||||
<!-- Search input -->
|
<!-- Search input -->
|
||||||
@ -27,8 +29,8 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div fxHide fxLayout="row" fxLayoutAlign="space-between" fxShow.lt-md="true"
|
<div id="header-container-mobile" fxLayout="row" fxLayoutAlign="space-between" fxShow
|
||||||
id="header-container-mobile">
|
fxHide.gt-sm="true">
|
||||||
|
|
||||||
<button mat-flat-button style="position: absolute;top: 0;left: 0;height: 60px;">
|
<button mat-flat-button style="position: absolute;top: 0;left: 0;height: 60px;">
|
||||||
<mat-icon style="transform: scale(1.3)">menu</mat-icon>
|
<mat-icon style="transform: scale(1.3)">menu</mat-icon>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { AuthService } from '@app/core/services/auth/auth.service';
|
||||||
|
|
||||||
@Component( {
|
@Component( {
|
||||||
selector: 'app-header',
|
selector: 'app-header',
|
||||||
@ -7,7 +8,7 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
} )
|
} )
|
||||||
export class HeaderComponent implements OnInit {
|
export class HeaderComponent implements OnInit {
|
||||||
|
|
||||||
constructor() {
|
constructor(private authService: AuthService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
.card {
|
||||||
|
box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
|
||||||
|
}
|
@ -1,3 +1,23 @@
|
|||||||
<p>
|
<div class="container pt-3">
|
||||||
register works!
|
<div class="row justify-content-sm-center">
|
||||||
</p>
|
<div class="col-sm-10 col-md-6">
|
||||||
|
<div class="card border-info">
|
||||||
|
<div class="card-header">Login</div>
|
||||||
|
<div class="card-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4 text-center">
|
||||||
|
<img src="https://placeimg.com/128/128/nature">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-8">
|
||||||
|
|
||||||
|
<input type="text" class="form-control mb-2" placeholder="Email" #userEmail required autofocus>
|
||||||
|
<input type="password" class="form-control mb-2" placeholder="Password" #userPassword required>
|
||||||
|
<button class="btn btn-lg btn-primary btn-block mb-1" (click)="authService.login(userEmail.value, userPassword.value)">Login</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -1,4 +1,5 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { AuthService } from '@app/core/services/auth/auth.service';
|
||||||
|
|
||||||
@Component( {
|
@Component( {
|
||||||
selector: 'app-register',
|
selector: 'app-register',
|
||||||
@ -7,7 +8,7 @@ import { Component, OnInit } from '@angular/core';
|
|||||||
} )
|
} )
|
||||||
export class RegisterComponent implements OnInit {
|
export class RegisterComponent implements OnInit {
|
||||||
|
|
||||||
constructor() {
|
constructor(private authService: AuthService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
|
Loading…
Reference in New Issue
Block a user