change authenticate routes

authentication related routes are scoped in /auth/... namespace with was
earlier /authntication/...
This commit is contained in:
Nuwan 2025-03-03 22:27:43 +05:30
parent 9d63882e69
commit 8cafb23b3e
19 changed files with 37 additions and 37 deletions

View File

@ -12,17 +12,17 @@ describe('forgot password', () => {
it('redirects to forgot password page', () => {
cy.visit('/');
cy.url().should('include', '/authentication/basic/login');
cy.url().should('include', '/auth/login');
cy.get('a')
.contains('Forgot password?')
.click();
cy.url().should('include', '/authentication/basic/forget-password');
cy.url().should('include', '/auth/forget-password');
cy.get('h5').contains('Forgot Your Password');
});
describe('validate forgot password form', () => {
beforeEach(() => {
cy.visit('/authentication/basic/forget-password');
cy.visit('/auth/forget-password');
cy.get('[data-testid=email]').clear();
cy.get('[data-testid=submit]').should('be.disabled');
});
@ -31,14 +31,14 @@ describe('forgot password', () => {
it('invalid email format', () => {
cy.get('[data-testid=email]').type('invalid-email-format@example');
cy.get('[data-testid=submit]').click();
cy.url().should('not.include', /\/authentication\/basic\/confirm-mail?\S+/);
cy.url().should('not.include', /\/auth\/confirm-mail?\S+/);
});
//valid email format but non-existing
it('valid email format but non-existing', () => {
cy.get('[data-testid=email]').type('valid-email-format@example.com');
cy.get('[data-testid=submit]').click();
cy.url().should('not.include', /\/authentication\/basic\/confirm-mail?\S+/);
cy.url().should('not.include', /\/auth\/confirm-mail?\S+/);
});
//valid and existing email
@ -47,7 +47,7 @@ describe('forgot password', () => {
cy.get('[data-testid=submit]').click();
cy.wait(3000);
cy.contains('Please check your email!');
cy.url().should('match', /\S+authentication\/basic\/confirm-mail?\S+/);
cy.url().should('match', /\S+auth\/confirm-mail?\S+/);
cy.contains('An email has been sent to nuwan@jamkazam.com.')
});
});

View File

@ -31,7 +31,7 @@ describe('Unauthenticated users redirect to login page', () => {
it('redirects to login page', () => {
cy.clearCookie('remeber_token')
cy.visit('/')
cy.url().should('include', '/authentication/basic/login')
cy.url().should('include', '/auth/login')
cy.contains('Sign In')
})
})
@ -42,7 +42,7 @@ describe('Login page', () => {
})
it('validate login form', () => {
cy.visit('/authentication/basic/login')
cy.visit('/auth/login')
cy.reload()
cy.get('[data-testid=submit]').should('be.disabled')
cy.get('[data-testid=email]').type('invalid-email-format@example')
@ -54,7 +54,7 @@ describe('Login page', () => {
})
it('submit login form with invalid credentials', () => {
cy.visit('/authentication/basic/login')
cy.visit('/auth/login')
cy.reload()
cy.get('[data-testid=email]').type('peter@example.com')
cy.get('[data-testid=password]').type('wrong')
@ -63,7 +63,7 @@ describe('Login page', () => {
})
it('submits login form', () => {
cy.visit('/authentication/basic/login')
cy.visit('/auth/login')
submitLogin()
cy.url().should('eq', Cypress.config().baseUrl + '/') // tests won't fail in case the port changes
//cy.contains('Signed in as peter@example.com')
@ -73,7 +73,7 @@ describe('Login page', () => {
it('redirect to requested page', () => {
cy.visit('/friends')
cy.url().should('include', '/authentication/basic/login')
cy.url().should('include', '/auth/login')
cy.reload()
submitLogin()
cy.url().should('eq', Cypress.config().baseUrl + '/friends')
@ -83,7 +83,7 @@ describe('Login page', () => {
describe('Forget password page', () => {
it('submit forget password form', () => {
cy.visit('/authentication/basic/forget-password')
cy.visit('/auth/forget-password')
cy.get('[data-testid=email]').type('peter@example.com')
cy.get('[data-testid=submit]').click()
cy.contains('An email is sent')

View File

@ -25,7 +25,7 @@ describe('Top Navigation', () => {
it('not allowed to protected page', () => {
cy.visit('/friends');
cy.wait('@getAppFeatures');
cy.url().should('include', '/authentication/basic/login');
cy.url().should('include', '/auth/login');
cy.contains('Sign in');
cy.get('button').should('have.text', 'Sign in');
cy.get('[data-testid=navbarTopProfileDropdown]').should('not.exist');

View File

@ -21,7 +21,7 @@ const ConfirmMailContent = ({ layout, titleTag: TitleTag }) => {
<p>
{t('confirmEmailContent.description_3')}
</p>
<Button tag={Link} color="primary" size="sm" className="mt-3" to={`/authentication/${layout}/login`}>
<Button tag={Link} color="primary" size="sm" className="mt-3" to={`/auth/login`}>
<FontAwesomeIcon icon="chevron-left" transform="shrink-4 down-1" className="mr-1" />
{t('confirmEmailContent.returnToLogin')}
</Button>

View File

@ -32,7 +32,7 @@ const ForgetPasswordForm = ({ setRedirect, setRedirectUrl, layout }) => {
};
useEffect(() => {
setRedirectUrl(`/authentication/${layout}/confirm-mail?email=${email}`);
setRedirectUrl(`/auth/confirm-mail?email=${email}`);
}, [setRedirectUrl, layout, email]);
return (

View File

@ -83,7 +83,7 @@ const LoginForm = ({ setRedirect, hasLabel, layout }) => {
/>
</Col>
<Col xs="auto">
<Link className="fs--1" to={`/authentication/${layout}/forget-password`}>
<Link className="fs--1" to={`/auth/forget-password`}>
Forget Password?
</Link>
{/* <a href="https://www.jamkazam.com/request_reset_password" target='_blank'>Forgot Password</a> */}

View File

@ -45,7 +45,7 @@ const PasswordResetForm = ({ setRedirect, setRedirectUrl, layout, hasLabel }) =>
};
useEffect(() => {
setRedirectUrl(`/authentication/${layout}/login`);
setRedirectUrl(`/auth/login`);
}, [setRedirectUrl, layout]);
// useEffect(() => {

View File

@ -24,7 +24,7 @@ const RegistrationForm = ({ setRedirect, setRedirectUrl, layout, hasLabel }) =>
};
useEffect(() => {
setRedirectUrl(`/authentication/${layout}/login`);
setRedirectUrl(`/auth/login`);
}, [setRedirectUrl, layout]);
useEffect(() => {

View File

@ -77,7 +77,7 @@ const Registration = () => {
<Row className='justify-content-center'>
<Col xs="auto">
<p className="fs--1 text-600">
{t('signupForm.alreadyHaveAccount')} <Link to="/authentication/basic/login">{t('signin')}</Link>
{t('signupForm.alreadyHaveAccount')} <Link to="/auth/login">{t('signin')}</Link>
</p>
</Col>
</Row>

View File

@ -15,7 +15,7 @@ const Login = () => {
</Col>
<Col xs="auto">
<p className="fs--1 text-600">
or <Link to="/authentication/basic/signup">{t('signup')}</Link>
or <Link to="/auth/signup">{t('signup')}</Link>
{/* <a href={`${process.env.REACT_APP_CLIENT_BASE_URL}/signup`}>{t('signup')}</a> */}
</p>
</Col>

View File

@ -11,7 +11,7 @@ const Registration = () => (
</Col>
<Col xs="auto">
<p className="fs--1 text-600">
Have an account? <Link to="/authentication/basic/login">Login</Link>
Have an account? <Link to="/auth/login">Login</Link>
</p>
</Col>
</Row>

View File

@ -60,7 +60,7 @@ const BodyComponent = ({
} else {
console.log("no user")
// redirect to the signup screen with the jamtrack & artist params set
window.location.href = "/authentication/basic/signup?artist=" + encodeURIComponent(artist) + '&jamtrack=' + encodeURIComponent(slug)
window.location.href = "/auth/signup?artist=" + encodeURIComponent(artist) + '&jamtrack=' + encodeURIComponent(slug)
}
} else {

View File

@ -43,7 +43,7 @@ const TopNavRightSideNavItem = () => {
</>
) : (
<NavItem className="d-none d-md-inline ml-6 mr-2">
<NavLink tag={Link} to="/authentication/basic/login">
<NavLink tag={Link} to="/auth/login">
{t('signin', { ns: 'auth' })}
</NavLink>
</NavItem>

View File

@ -42,7 +42,7 @@ const ProfileDropdown = () => {
<DropdownItem tag={Link} to="/pages/settings">
Settings
</DropdownItem>
<DropdownItem tag={Link} to="/authentication/basic/logout">
<DropdownItem tag={Link} to="/auth/logout">
Logout
</DropdownItem>
</div>

View File

@ -19,7 +19,7 @@ const PrivateRoute = ({ component: Component, ...otherProps }) => {
// <Redirect to={otherProps.redirectTo ? otherProps.redirectTo : '/authentication/basic/login'} />
<Redirect
to={{
pathname: otherProps.redirectTo ? otherProps.redirectTo : '/authentication/basic/login',
pathname: otherProps.redirectTo ? otherProps.redirectTo : '/auth/login',
state: { from: props.location }
}}
/>

View File

@ -21,7 +21,7 @@ const Layout = () => {
<Router fallback={<span />}>
<Switch>
<Route path="/errors" component={ErrorLayout} />
<Route path="/authentication/basic" component={AuthBasicLayout} />
<Route path="/auth" component={AuthBasicLayout} />
<Route path="/public" component={PublicLayout} />
<Route component={DashboardLayout} />
</Switch>

View File

@ -30,7 +30,7 @@ const Layout = () => {
<Route path="/authentication/split" component={AuthSplitRoutes} />
<Route path="/authentication/wizard" component={WizardLayout} />
<Route path="/errors" component={ErrorLayout} />
<Route path="/authentication/basic" component={AuthBasicLayout} />
<Route path="/auth" component={AuthBasicLayout} />
<Route component={DashboardLayout} />
</Switch>
<ToastContainer transition={Fade} closeButton={<CloseButton />} position={toast.POSITION.BOTTOM_LEFT} />

View File

@ -129,20 +129,20 @@ export const homeRoutes = {
export const authenticationRoutes = {
name: 'Authentication',
to: '/authentication',
to: '/auth',
icon: 'lock',
children: [
{
to: '/authentication/basic',
to: '/auth/basic',
name: 'Basic',
children: [
{ to: '/authentication/basic/login', name: 'Login' },
{ to: '/authentication/basic/logout', name: 'Logout' },
{ to: '/authentication/basic/register', name: 'Register' },
{ to: '/authentication/basic/forget-password', name: 'Forgot password' },
{ to: '/authentication/basic/password-reset', name: 'Reset password' },
{ to: '/authentication/basic/confirm-mail', name: 'Confirm mail' },
{ to: '/authentication/basic/lock-screen', name: 'Lock screen' }
{ to: '/auth/login', name: 'Login' },
{ to: '/auth/logout', name: 'Logout' },
{ to: '/auth/register', name: 'Register' },
{ to: '/auth/forget-password', name: 'Forgot password' },
{ to: '/auth/password-reset', name: 'Reset password' },
{ to: '/auth/confirm-mail', name: 'Confirm mail' },
{ to: '/auth/lock-screen', name: 'Lock screen' }
]
},
{

View File

@ -1126,7 +1126,7 @@ module JamRuby
user.reset_password_token_created = Time.now
user.save(validate:false)
reset_url = "#{base_uri}/authentication/basic/reset_password_token?token=#{user.reset_password_token}&email=#{CGI.escape(email)}"
reset_url = "#{base_uri}/auth/reset_password_token?token=#{user.reset_password_token}&email=#{CGI.escape(email)}"
UserMailer.password_reset(user, reset_url).deliver_now
user
end