add password validation plus some cleanup

This commit is contained in:
Zhigang Wang 2024-06-07 15:10:06 -07:00
parent 591de12e69
commit 510a879b5e
9 changed files with 27 additions and 47 deletions

View File

@ -1,7 +1,12 @@
<template>
<div class="header-container">
<div class="header-content">
<img class="company-logo" alt="freeleaps logo" src="@/assets/freeleaps.png" />
<img
class="company-logo"
alt="freeleaps logo"
src="@/assets/freeleaps.png"
@click="gotoFrontdoor()"
/>
<!-- <div class="content-area">
<span class="company-slogan"
>Freeleaps: A trustworthy platform to find a software development partner</span
@ -22,6 +27,9 @@ export default {
components: {},
computed: {},
methods: {
gotoFrontdoor() {
this.mnx_navToFrontDoor()
},
gotoAbout() {
this.mnx_navToAbout()
},
@ -57,6 +65,7 @@ export default {
.company-logo {
height: 40px;
cursor: pointer;
}
.company-slogan {

View File

@ -38,7 +38,7 @@
</template>
<script>
import { UserAuthApi } from '../../utils/index'
import { UserAuthApi, passwordValidator } from '../../utils/index'
export default {
name: 'NewUserSetPassword',
props: {},
@ -67,7 +67,7 @@ export default {
this.message = 'The two passwords are not matched'
return
}
this.message = passwordValidator.validate(this.password)
if (this.message != null) return
UserAuthApi.updatePassword(this.password, this.password2)

View File

@ -762,7 +762,12 @@
<script>
import { moneyCollectionTypeEnum } from '../../../types/index'
import { UserProfileApi, elementHandler, textAreaAujuster } from '../../../utils/index'
import {
UserProfileApi,
elementHandler,
textAreaAujuster,
passwordValidator
} from '../../../utils/index'
export default {
name: 'UserProfile',
@ -984,7 +989,10 @@ export default {
} else if (!this.passwordOperation.password) {
//Do nothing since there is no password input
} else {
this.updatePassword(this.passwordOperation.password, this.passwordOperation.password2)
this.passwordOperation.message = passwordValidator.validate(this.passwordOperation.password)
if (!this.passwordOperation.password) {
this.updatePassword(this.passwordOperation.password, this.passwordOperation.password2)
}
}
},

View File

@ -386,7 +386,6 @@ const router = createRouter({
})
router.beforeEach(function (to, from, next) {
console.log('beforeEach', to)
if (to.name == 'front-door') {
next()
} else if (to.meta.requiredRoles.includes(userRoleEnum.NONE)) {

View File

@ -14,6 +14,6 @@ export { userUtils, userProfileUtils, requestIssueUtils, requestHubUtils } from
export { ValueChecker, DateUtils, OIDUtils } from './common/index'
export { userProfileValidator } from './validator/index'
export { passwordValidator } from './validator/index'
export { textAreaAujuster, tooltip, elementHandler, mediaDataHandler } from './html/index'

View File

@ -1,8 +1 @@
export { userProfileValidator } from './userProfile'
export { businessProfileValidator } from './businessProfile'
export { problemValidator } from './problemValidator'
export { codingInterviewValidator } from './codingInterviewValidator'
export { jobPositionValidator } from './jobPositionValidator'
export { applicantValidator } from './applicantValidator'
export { solutionSubmissionValidator } from './solutionSubmissionValidator'
export { uploadFileLengthValidator } from './uploadFileLengthValidator'
export { passwordValidator } from './passwordValidator'

View File

@ -22,5 +22,5 @@ class PasswordValidator extends TextValidator {
)
}
}
export { PasswordValidator }
const passwordValidator = new PasswordValidator()
export { passwordValidator }

View File

@ -1,29 +0,0 @@
import { UsernameValidator } from './usernameValidator'
import { PasswordValidator } from './passwordValidator'
import { NameValidator } from './nameValidator'
import { MobileValidator } from './mobileValidator'
import { EmailValidator } from './emailValidator'
import { ImageValidator } from './imageValidator'
import { AuthCodeValidator } from './authCodeValidator'
import { CountryNameValidator } from './countryNameValidator'
import { FilenameValidator } from './filenameValidator'
import { TextFileValidator } from './textFileValidator'
class ProfileValidator {
constructor() {
this.usernameValidator = new UsernameValidator()
this.passwordValidator = new PasswordValidator()
this.nameValidator = new NameValidator()
this.mobileValidator = new MobileValidator()
this.emailValidator = new EmailValidator()
this.imageValidator = new ImageValidator()
this.authCodeValidator = new AuthCodeValidator()
this.countryNameValidator = new CountryNameValidator()
this.resumenameValidator = new FilenameValidator()
this.resumeFileValidator = new TextFileValidator()
}
}
const userProfileValidator = new ProfileValidator()
export { userProfileValidator }

View File

@ -38,7 +38,7 @@ export default defineConfig({
server: {
proxy: {
'^/api/': {
target: 'https://localhost:8001/',
target: 'http://localhost:8001/',
ws: true,
changeOrigin: true
}