From 4f751e5cd22f67d24bc1445794d1b03f3daf9937 Mon Sep 17 00:00:00 2001 From: Tung Nguyen Date: Thu, 26 Dec 2019 13:00:17 +0000 Subject: [PATCH] fix typos and improve messages showing at the end users --- app/api/views/new_custom_alias.py | 17 +++++++++-------- app/auth/views/activate.py | 4 ++-- app/auth/views/facebook.py | 2 +- app/auth/views/github.py | 2 +- app/auth/views/login.py | 2 +- app/auth/views/resend_activation.py | 6 +++--- app/auth/views/reset_password.py | 4 ++-- app/email_utils.py | 2 +- 8 files changed, 20 insertions(+), 19 deletions(-) diff --git a/app/api/views/new_custom_alias.py b/app/api/views/new_custom_alias.py index de23bdd4..dab66e3d 100644 --- a/app/api/views/new_custom_alias.py +++ b/app/api/views/new_custom_alias.py @@ -22,15 +22,16 @@ def new_custom_alias(): optional "hostname" in args Output: 201 if success - 409 if alias already exists + 409 if the alias already exists """ user = g.user if not user.can_create_new_alias(): - LOG.d("user %s cannot create custom alias", user) + LOG.d("user %s cannot create any custom alias", user) return ( jsonify( - error="You have created 3 custom aliases, please upgrade to create more" + error="You have reached the limitation of a free account with the maximum of " + "3 custom aliases, please upgrade your plan to create more custom aliases" ), 400, ) @@ -46,7 +47,7 @@ def new_custom_alias(): alias_prefix = alias_prefix.strip() alias_prefix = convert_to_id(alias_prefix) if not alias_prefix: # should be checked on frontend - LOG.d("user %s submits empty alias prefix %s", user, alias_prefix) + LOG.d("user %s submits an empty alias with the prefix %s", user, alias_prefix) return jsonify(error="alias prefix cannot be empty"), 400 # make sure alias_suffix is either .random_letters@simplelogin.co or @my-domain.com @@ -54,19 +55,19 @@ def new_custom_alias(): if alias_suffix.startswith("@"): custom_domain = alias_suffix[1:] if custom_domain not in user_custom_domains: - LOG.d("user %s submits wrong custom domain %s ", user, custom_domain) + LOG.d("user %s submits a wrong custom domain %s ", user, custom_domain) return jsonify(error="error"), 400 else: if not alias_suffix.startswith("."): - LOG.d("user %s submits wrong alias suffix %s", user, alias_suffix) + LOG.d("user %s submits a wrong alias suffix %s", user, alias_suffix) return jsonify(error="error"), 400 if not alias_suffix.endswith(EMAIL_DOMAIN): - LOG.d("user %s submits wrong alias suffix %s", user, alias_suffix) + LOG.d("user %s submits a wrong alias suffix %s", user, alias_suffix) return jsonify(error="error"), 400 random_letters = alias_suffix[1 : alias_suffix.find("@")] if len(random_letters) < 5: - LOG.d("user %s submits wrong alias suffix %s", user, alias_suffix) + LOG.d("user %s submits a wrong alias suffix %s", user, alias_suffix) return jsonify(error="error"), 400 full_alias = alias_prefix + alias_suffix diff --git a/app/auth/views/activate.py b/app/auth/views/activate.py index 61f663c0..d3eea5a0 100644 --- a/app/auth/views/activate.py +++ b/app/auth/views/activate.py @@ -22,7 +22,7 @@ def activate(): if not activation_code: return ( - render_template("auth/activate.html", error="Activation code not found"), + render_template("auth/activate.html", error="Activation code cannot be found"), 400, ) @@ -30,7 +30,7 @@ def activate(): return ( render_template( "auth/activate.html", - error="Activation code is expired", + error="Activation code was expired", show_resend_activation=True, ), 400, diff --git a/app/auth/views/facebook.py b/app/auth/views/facebook.py index ef5cc305..1aa95528 100644 --- a/app/auth/views/facebook.py +++ b/app/auth/views/facebook.py @@ -48,7 +48,7 @@ def facebook_login(): def facebook_callback(): # user clicks on cancel if "error" in request.args: - flash("please use another sign in method then", "warning") + flash("Please use another sign in method then", "warning") return redirect("/") facebook = OAuth2Session( diff --git a/app/auth/views/github.py b/app/auth/views/github.py index 6e336daa..00030409 100644 --- a/app/auth/views/github.py +++ b/app/auth/views/github.py @@ -40,7 +40,7 @@ def github_login(): def github_callback(): # user clicks on cancel if "error" in request.args: - flash("please use another sign in method then", "warning") + flash("Please use another sign in method then", "warning") return redirect("/") github = OAuth2Session( diff --git a/app/auth/views/login.py b/app/auth/views/login.py index da7ce6fa..b2c214e6 100644 --- a/app/auth/views/login.py +++ b/app/auth/views/login.py @@ -27,7 +27,7 @@ def login(): user = User.filter_by(email=form.email.data).first() if not user: - flash("Email not exist in our system", "error") + flash("The email entered does not exist in our system", "error") elif not user.check_password(form.password.data): flash("Wrong password", "error") elif not user.activated: diff --git a/app/auth/views/resend_activation.py b/app/auth/views/resend_activation.py index f6fe00e9..88292f5b 100644 --- a/app/auth/views/resend_activation.py +++ b/app/auth/views/resend_activation.py @@ -20,17 +20,17 @@ def resend_activation(): user = User.filter_by(email=form.email.data).first() if not user: - flash("There's no such email", "warning") + flash("There is no such email", "warning") return render_template("auth/resend_activation.html", form=form) if user.activated: - flash("your account is already activated, please login", "success") + flash("Your account was already activated, please login", "success") return redirect(url_for("auth.login")) # user is not activated LOG.d("user %s is not activated", user) flash( - "An activation email is on its way, please check your inbox/spam folder", + "An activation email has been sent to you. Please check your inbox/spam folder.", "warning", ) send_activation_email(user, request.args.get("next")) diff --git a/app/auth/views/reset_password.py b/app/auth/views/reset_password.py index b9400fd9..9c101f91 100644 --- a/app/auth/views/reset_password.py +++ b/app/auth/views/reset_password.py @@ -28,13 +28,13 @@ def reset_password(): if not reset_password_code: error = ( "The reset password link can be used only once. " - "Please make a new request to reset password" + "Please request a new link to reset password." ) return render_template("auth/reset_password.html", form=form, error=error) if reset_password_code.is_expired(): error = ( - "The link is already expired. Please make a new request to reset password" + "The link has been already expired. Please make a new request of the reset password link" ) return render_template("auth/reset_password.html", form=form, error=error) diff --git a/app/email_utils.py b/app/email_utils.py index ef961a21..27c1b48a 100644 --- a/app/email_utils.py +++ b/app/email_utils.py @@ -86,7 +86,7 @@ def send_change_email(new_email, current_email, name, link): def send_new_app_email(email, name): send_email( email, - f"{name}, any questions/feedbacks for SimpleLogin?", + f"{name}, any question/feedback for SimpleLogin?", _render("new-app.txt", name=name), _render("new-app.html", name=name), )