Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Minor updates

Blaumaus8f4cc93107b3
diff --git a/src/App.js b/src/App.js
index 7ffcb9425..6f7e240c5 100644
--- a/src/App.js
+++ b/src/App.js
@@ -9,6 +9,7 @@ import MainPage from 'pages/MainPage'
import SignUp from 'pages/Auth/Signup'
import SignIn from 'pages/Auth/Signin'
import ForgotPassword from 'pages/Auth/ForgotPassword'
+import CreateNewPassword from 'pages/Auth/CreateNewPassword'
import Dashboard from 'pages/Dashboard'
import UserSettings from 'pages/UserSettings'
import VerifyEmail from 'pages/Auth/VerifyEmail'
@@ -23,6 +24,7 @@ import { alertsActions } from 'actions/alerts'
const ProtectedSignIn = notAuthenticated(SignIn)
const ProtectedSignUp = notAuthenticated(SignUp)
const ProtectedForgotPassword = notAuthenticated(ForgotPassword)
+const ProtectedNewPasswordForm = notAuthenticated(CreateNewPassword)
const ProtectedDashboard = isAuthenticated(Dashboard)
const ProtectedUserSettings = isAuthenticated(UserSettings)
@@ -47,7 +49,7 @@ const App = () => {
useEffect(() => {
if (error) {
- alert.error(error, {
+ alert.error(error.toString(), {
onClose: () => {
dispatch(errorsActions.clearErrors())
}
@@ -57,7 +59,7 @@ const App = () => {
useEffect(() => {
if (message && type) {
- alert.show(message, {
+ alert.show(message.toString(), {
type,
onClose: () => {
dispatch(alertsActions.clearAlerts())
@@ -79,6 +81,7 @@ const App = () => {
<Route path={routes.verify} component={VerifyEmail} exact />
<Route path={routes.change_email} component={VerifyEmail} exact />
<Route path={routes.reset_password} component={ProtectedForgotPassword} exact />
+ <Route path={routes.new_password_form} component={ProtectedNewPasswordForm} exact />
<Redirect to={routes.main} />
</Switch>
</>
diff --git a/src/actions/auth/index.js b/src/actions/auth/index.js
index 02194c178..b519fe9cc 100644
--- a/src/actions/auth/index.js
+++ b/src/actions/auth/index.js
@@ -32,7 +32,6 @@ export const authActions = {
logout() {
localStorage.removeItem('access_token')
localStorage.removeItem('user_info')
- document.cookie = 'email_confirm=false max-age=0 path=/'
return {
type: types.LOGOUT
diff --git a/src/pages/Auth/CreateNewPassword/ForgotPassword.container.jsx b/src/pages/Auth/CreateNewPassword/ForgotPassword.container.jsx
deleted file mode 100644
index abf6f99c2..000000000
--- a/src/pages/Auth/CreateNewPassword/ForgotPassword.container.jsx
+++ /dev/null
@@ -1,28 +0,0 @@
-import { useDispatch } from 'react-redux'
-import { useHistory } from 'react-router-dom'
-
-import ForgotPassword from './ForgotPassword'
-import { forgotPassword } from 'api'
-import { errorsActions } from 'actions/errors'
-import { alertsActions } from 'actions/alerts'
-import routes from 'routes'
-
-export default () => {
- const dispatch = useDispatch()
- const history = useHistory()
-
- const onSubmit = async (data) => {
- try {
- await forgotPassword(data)
-
- dispatch(alertsActions.newPassword('A password reset e-mail has been sent to the specified address'))
- history.push(routes.main)
- } catch (e) {
- dispatch(errorsActions.createNewPasswordFailed(e.toString()))
- }
- }
-
- return (
- <ForgotPassword onSubmit={onSubmit} />
- )
-}
\ No newline at end of file
diff --git a/src/pages/Auth/CreateNewPassword/ForgotPassword.jsx b/src/pages/Auth/CreateNewPassword/ForgotPassword.jsx
deleted file mode 100644
index c1af7eed0..000000000
--- a/src/pages/Auth/CreateNewPassword/ForgotPassword.jsx
+++ /dev/null
@@ -1,86 +0,0 @@
-import React, { useState, useEffect } from 'react'
-import { Link } from 'react-router-dom'
-import Form from 'react-bootstrap/Form'
-
-import routes from 'routes'
-import { isValidEmail, isValidPassword } from 'utils/validator'
-
-export default ({ onSubmit }) => {
- const [form, setForm] = useState({
- email: '',
- })
- const [validated, setValidated] = useState(false)
- const [errors, setErrors] = useState({})
- const [beenSubmitted, setBeenSubmitted] = useState(false)
-
- useEffect(() => {
- validate()
- }, [form])
-
- const handleInput = event => {
- const t = event.target
- const value = t.type === 'checkbox' ? t.checked : t.value
-
- setForm(form => ({
- ...form,
- [t.name]: value,
- }))
- }
-
- const handleSubmit = e => {
- e.preventDefault()
- e.stopPropagation()
- setBeenSubmitted(true)
-
- if (validated) {
- onSubmit(form)
- }
- }
-
- const validate = () => {
- const allErrors = {}
-
- if (!isValidEmail(form.email)) {
- allErrors.email = 'Please provide a valid email.'
- }
-
- const valid = Object.keys(allErrors).length === 0
-
- setErrors(allErrors)
- setValidated(valid)
- }
-
- return (
- <div className="container">
- <h4 className="mb-3">Account recovery</h4>
- <Form validated={validated} onSubmit={handleSubmit} noValidate>
- <Form.Group className="mb-3 has-validation">
- <Form.Label htmlFor="email">Email</Form.Label>
- <Form.Control
- type="email"
- value={form.email}
- placeholder="[email protected]"
- id="email"
- className="form-control"
- name="email"
- onChange={handleInput}
- isValid={!errors.hasOwnProperty('email')}
- isInvalid={beenSubmitted && errors.hasOwnProperty('email')}
- required
- />
- <Form.Control.Feedback type="invalid">
- {errors.email}
- </Form.Control.Feedback>
- </Form.Group>
- <div className="d-flex align-items-center mb-3">
- <Link to={routes.signin} className="btn btn-link">
- Sign in
- </Link>
- <button type="submit" className="btn btn-primary ml-auto">
- Reset password
- </button>
- </div>
- </Form>
- </div>
- )
-}
\ No newline at end of file
diff --git a/src/pages/Auth/Signup/Signup.jsx b/src/pages/Auth/Signup/Signup.jsx
index 7abc5ec2a..94d56f44e 100644
--- a/src/pages/Auth/Signup/Signup.jsx
+++ b/src/pages/Auth/Signup/Signup.jsx
@@ -161,7 +161,7 @@ export default ({ onSubmit }) => {
</Link>
<button type="submit" className="btn btn-primary ml-auto">
Sign up
- </button>
+ </button>
</div>
</Form>
</div>