mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-07-18 10:36:11 +00:00
修复申请原因可能为空的bug
This commit is contained in:
@@ -155,7 +155,7 @@ public class AuthController {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (req.reason == null || req.reason.length() <= 20) {
|
if (req.reason == null || req.reason.trim().length() <= 20) {
|
||||||
return ResponseEntity.badRequest().body(Map.of(
|
return ResponseEntity.badRequest().body(Map.of(
|
||||||
"error", "Reason's length must longer than 20",
|
"error", "Reason's length must longer than 20",
|
||||||
"reason_code", "INVALID_CREDENTIALS"
|
"reason_code", "INVALID_CREDENTIALS"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
为了我们社区的良性发展,请填写注册理由,我们将根据你的理由审核你的注册, 谢谢!
|
为了我们社区的良性发展,请填写注册理由,我们将根据你的理由审核你的注册, 谢谢!
|
||||||
</div>
|
</div>
|
||||||
<div class="reason-input-container">
|
<div class="reason-input-container">
|
||||||
<BaseInput textarea rows="4" v-model="reason" placeholder="20个字以上" ></BaseInput>
|
<BaseInput textarea rows="4" v-model="reason" placeholder="20个字以上"></BaseInput>
|
||||||
<div class="char-count">{{ reason.length }}/20</div>
|
<div class="char-count">{{ reason.length }}/20</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="error" class="error-message">{{ error }}</div>
|
<div v-if="error" class="error-message">{{ error }}</div>
|
||||||
@@ -18,11 +18,11 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import BaseInput from '../components/BaseInput.vue'
|
import BaseInput from '../components/BaseInput.vue'
|
||||||
import { API_BASE_URL, toast } from '../main'
|
import {API_BASE_URL, toast} from '../main'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'SignupReasonPageView',
|
name: 'SignupReasonPageView',
|
||||||
components: { BaseInput },
|
components: {BaseInput},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
reason: '',
|
reason: '',
|
||||||
@@ -34,12 +34,12 @@ export default {
|
|||||||
mounted() {
|
mounted() {
|
||||||
this.token = this.$route.query.token || ''
|
this.token = this.$route.query.token || ''
|
||||||
if (!this.token) {
|
if (!this.token) {
|
||||||
this.$router.push('/signup')
|
this.$router.push('/signup')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async submit() {
|
async submit() {
|
||||||
if (!this.reason || this.reason.length < 20) {
|
if (!this.reason || this.reason.trim().length < 20) {
|
||||||
this.error = '请至少输入20个字'
|
this.error = '请至少输入20个字'
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -48,7 +48,7 @@ export default {
|
|||||||
this.isWaitingForRegister = true
|
this.isWaitingForRegister = true
|
||||||
const res = await fetch(`${API_BASE_URL}/api/auth/reason`, {
|
const res = await fetch(`${API_BASE_URL}/api/auth/reason`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
|
|||||||
Reference in New Issue
Block a user