Skip to content
Snippets Groups Projects
Unverified Commit db6909d7 authored by Ahmad Farhat's avatar Ahmad Farhat Committed by GitHub
Browse files

Various minor bug fixes (#4193)

* Minor bug fixes

* Add back schema
parent 59763216
Branches
No related tags found
No related merge requests found
......@@ -29,6 +29,7 @@ export default function ChangePwdForm() {
onClick={() => methods.reset({
old_password: '',
new_password: '',
password_confirmation: '',
})}
>
{ t('cancel') }
......
import toast from 'react-hot-toast';
import { useTranslation } from 'react-i18next';
import { useMutation, useQueryClient } from 'react-query';
import { useNavigate } from 'react-router-dom';
import axios from '../../../helpers/Axios';
export default function useActivateAccount(token) {
const queryClient = useQueryClient();
const { t } = useTranslation();
const navigate = useNavigate();
return useMutation(
() => axios.post('/verify_account/activate.json', { user: { token } }),
......@@ -13,6 +15,7 @@ export default function useActivateAccount(token) {
onSuccess: () => {
queryClient.invalidateQueries('useSessions');
toast.success(t('toast.success.user.account_activated'));
navigate('/rooms');
},
onError: () => {
toast.error(t('toast.error.problem_completing_action'));
......
......@@ -10,7 +10,7 @@ export default function useChangePwd() {
(user) => axios.post('/users/change_password.json', { user }),
{
onSuccess: () => {
toast.success(t('toast.success.password_updated'));
toast.success(t('toast.success.user.password_updated'));
},
onError: () => {
toast.error(t('toast.error.problem_completing_action'));
......
......@@ -14,7 +14,7 @@ export default function useUpdateUser(userId) {
{
onSuccess: () => {
queryClient.invalidateQueries('useSessions');
toast.success(t('toast.success.user_deleted'));
toast.success(t('toast.success.user.user_deleted'));
navigate('/');
},
onError: () => {
......
......@@ -9,14 +9,14 @@ export default function AuthenticatedOnly() {
const { t } = useTranslation();
const currentUser = useAuth();
if (!currentUser.verified) {
return <VerifyAccount currentUser={currentUser} />;
}
if (!currentUser.signed_in) {
toast.error(t('toast.error.signin_required'));
return <Navigate to="/" />;
}
if (!currentUser.verified) {
return <VerifyAccount currentUser={currentUser} />;
}
return <Outlet />;
}
......@@ -14,7 +14,8 @@ User.create(
password: 'Administrator1!',
provider: 'greenlight',
language: 'en',
role: Role.find_by(name: 'Administrator')
role: Role.find_by(name: 'Administrator'),
verified: true
)
Rails.logger.debug 'Successfully created an administrator account'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment