瀏覽代碼

feat: added alert when user succesfully verified their email

Kristian Vos 5 年之前
父節點
當前提交
0f1963c7ae
共有 2 個文件被更改,包括 19 次插入8 次删除
  1. 1 1
      backend/logic/app.js
  2. 18 7
      frontend/App.vue

+ 1 - 1
backend/logic/app.js

@@ -232,7 +232,7 @@ const lib = {
 					return res.json({ status: 'failure', message: error});
 				}
 				logger.success("VERIFY_EMAIL", `Successfully verified email.`);
-				res.redirect(config.get("domain"));
+				res.redirect(`${config.get("domain")}?msg=Thank you for verifying your email`);
 			});
 		});
 

+ 18 - 7
frontend/App.vue

@@ -101,13 +101,24 @@ export default {
 		lofig.get("serverDomain", res => {
 			_this.serverDomain = res;
 		});
-		if (_this.$route.query.err) {
-			let err = _this.$route.query.err;
-			err = err
-				.replace(new RegExp("<", "g"), "&lt;")
-				.replace(new RegExp(">", "g"), "&gt;");
-			Toast.methods.addToast(err, 20000);
-		}
+		_this.$router.onReady(() => {
+			if (_this.$route.query.err) {
+				let err = _this.$route.query.err;
+				err = err
+					.replace(new RegExp("<", "g"), "&lt;")
+					.replace(new RegExp(">", "g"), "&gt;");
+				_this.$router.push({ query: {} });
+				Toast.methods.addToast(err, 20000);
+			}
+			if (_this.$route.query.msg) {
+				let msg = _this.$route.query.msg;
+				msg = msg
+					.replace(new RegExp("<", "g"), "&lt;")
+					.replace(new RegExp(">", "g"), "&gt;");
+				_this.$router.push({ query: {} });
+				Toast.methods.addToast(msg, 20000);
+			}
+		});
 		io.getSocket(true, socket => {
 			socket.on("keep.event:user.session.removed", () => {
 				location.reload();