mirror of https://github.com/PiyushXCoder/lupt.git
bug fix
This commit is contained in:
parent
909cbb8975
commit
87ecf0faf3
|
|
@ -19,6 +19,7 @@ pub enum Validation {
|
||||||
NoGupt,
|
NoGupt,
|
||||||
NoSpace,
|
NoSpace,
|
||||||
NoHashtag,
|
NoHashtag,
|
||||||
|
NoAndOrQuestion,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn validate(val: Vec<Validation>, dat: &str, entry_name: &str) -> Option<String> {
|
pub fn validate(val: Vec<Validation>, dat: &str, entry_name: &str) -> Option<String> {
|
||||||
|
|
@ -27,7 +28,8 @@ pub fn validate(val: Vec<Validation>, dat: &str, entry_name: &str) -> Option<Str
|
||||||
Validation::NonEmpty => non_empty(dat, entry_name),
|
Validation::NonEmpty => non_empty(dat, entry_name),
|
||||||
Validation::NoGupt => is_gupt(dat),
|
Validation::NoGupt => is_gupt(dat),
|
||||||
Validation::NoSpace => no_space(dat, entry_name),
|
Validation::NoSpace => no_space(dat, entry_name),
|
||||||
Validation::NoHashtag => no_hashtag(dat, entry_name)
|
Validation::NoHashtag => no_hashtag(dat, entry_name),
|
||||||
|
Validation::NoAndOrQuestion => no_and_or_question(dat, entry_name),
|
||||||
};
|
};
|
||||||
|
|
||||||
if out != None {
|
if out != None {
|
||||||
|
|
@ -67,4 +69,15 @@ fn no_hashtag(dat: &str, entry_name: &str) -> Option<String> {
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn no_and_or_question(dat: &str, entry_name: &str) -> Option<String> {
|
||||||
|
if dat.contains("&") {
|
||||||
|
Some(format!("{} shounld not have &", entry_name))
|
||||||
|
} else if dat.contains("?") {
|
||||||
|
Some(format!("{} shounld not have ?", entry_name))
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -63,10 +63,10 @@ impl WsSansad {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
if let Some(val ) = validate(vec![vl::NonEmpty, vl::NoSpace, vl::NoHashtag], &kunjika, "Kunjika") {
|
if let Some(val ) = validate(vec![vl::NonEmpty, vl::NoSpace, vl::NoHashtag, vl::NoAndOrQuestion], &kunjika, "Kunjika") {
|
||||||
self.send_err_response(&val);
|
self.send_err_response(&val);
|
||||||
return;
|
return;
|
||||||
} else if let Some(val ) = validate(vec![vl::NonEmpty], &name, "Name") {
|
} else if let Some(val ) = validate(vec![vl::NonEmpty, vl::NoAndOrQuestion], &name, "Name") {
|
||||||
self.send_err_response(&val);
|
self.send_err_response(&val);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -183,13 +183,13 @@ impl WsSansad {
|
||||||
|
|
||||||
|
|
||||||
// Validate
|
// Validate
|
||||||
if let Some(val ) = validate(vec![vl::NonEmpty, vl::NoGupt, vl::NoSpace], &kaksh_kunjika, "Kaksh Kunjika") {
|
if let Some(val ) = validate(vec![vl::NonEmpty, vl::NoGupt, vl::NoSpace, vl::NoAndOrQuestion], &kaksh_kunjika, "Kaksh Kunjika") {
|
||||||
self.send_err_response(&val);
|
self.send_err_response(&val);
|
||||||
return;
|
return;
|
||||||
} else if let Some(val ) = validate(vec![vl::NonEmpty, vl::NoSpace, vl::NoHashtag], &kunjika, "Kunjika") {
|
} else if let Some(val ) = validate(vec![vl::NonEmpty, vl::NoSpace, vl::NoHashtag, vl::NoAndOrQuestion], &kunjika, "Kunjika") {
|
||||||
self.send_err_response(&val);
|
self.send_err_response(&val);
|
||||||
return;
|
return;
|
||||||
} else if let Some(val ) = validate(vec![vl::NonEmpty], &name, "Name") {
|
} else if let Some(val ) = validate(vec![vl::NonEmpty, vl::NoAndOrQuestion], &name, "Name") {
|
||||||
self.send_err_response(&val);
|
self.send_err_response(&val);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
<svg width="24px" height="24px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><g data-name="Layer 2"><rect width="24" height="24" transform="rotate(180 12 12)" opacity="0"/><path d="M12 1A10.89 10.89 0 0 0 1 11.77 10.79 10.79 0 0 0 8.52 22c.55.1.75-.23.75-.52v-1.83c-3.06.65-3.71-1.44-3.71-1.44a2.86 2.86 0 0 0-1.22-1.58c-1-.66.08-.65.08-.65a2.31 2.31 0 0 1 1.68 1.11 2.37 2.37 0 0 0 3.2.89 2.33 2.33 0 0 1 .7-1.44c-2.44-.27-5-1.19-5-5.32a4.15 4.15 0 0 1 1.11-2.91 3.78 3.78 0 0 1 .11-2.84s.93-.29 3 1.1a10.68 10.68 0 0 1 5.5 0c2.1-1.39 3-1.1 3-1.1a3.78 3.78 0 0 1 .11 2.84A4.15 4.15 0 0 1 19 11.2c0 4.14-2.58 5.05-5 5.32a2.5 2.5 0 0 1 .75 2v2.95c0 .35.2.63.75.52A10.8 10.8 0 0 0 23 11.77 10.89 10.89 0 0 0 12 1" data-name="github"/></g></svg>
|
||||||
|
After Width: | Height: | Size: 752 B |
|
|
@ -97,17 +97,15 @@
|
||||||
</form>
|
</form>
|
||||||
</tabs>
|
</tabs>
|
||||||
<div class="is-center text-center">
|
<div class="is-center text-center">
|
||||||
<small>
|
<pre>By tapping "Connect" button I agree with <a href="/terms.html">Terms of Service</a> and <a href="policy.html">Privacy Policy</a></pre>
|
||||||
By tapping "Connect" button I agree with
|
|
||||||
<a href="/terms.html">Terms of Service</a> and
|
|
||||||
<a href="policy.html">Privacy Policy</a>
|
|
||||||
</small>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<footer class="is-center" style="padding: 60px;">
|
<div class="is-center" style="padding: 20px 0px;">
|
||||||
<small>Made with ❤️️ by <a href="https://gitlab.com/PiyushXCoder" >Piyush Mishra</a></small>
|
<pre>Made with ❤️️ by <a href="https://github.com/PiyushXCoder">Piyush Mishra</a></pre>
|
||||||
</footer>
|
</div>
|
||||||
|
<div class="is-center" style="padding-bottom: 10px;">
|
||||||
|
<a href="https://github.com/PiyushXCoder/lupt"><img class="svg-filter" src="img/github.svg" height="50" alt="GitHub"></a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Chat Screen -->
|
<!-- Chat Screen -->
|
||||||
|
|
|
||||||
|
|
@ -153,9 +153,9 @@ function connect(frm) {
|
||||||
|
|
||||||
//push url
|
//push url
|
||||||
var frm = $('form[name=kaksh_sec]');
|
var frm = $('form[name=kaksh_sec]');
|
||||||
var url = '/?' + frm.find('[name=kaksh_kunjika]').val() + '&' +
|
var url = '/?' + encodeURI(frm.find('[name=kaksh_kunjika]').val()) + '&' +
|
||||||
frm.find('[name=kunjika]').val() + '&' +
|
encodeURI(frm.find('[name=kunjika]').val()) + '&' +
|
||||||
frm.find('[name=name]').val();
|
encodeURI(frm.find('[name=name]').val());
|
||||||
history.pushState({}, 'Lupt Chat', url);
|
history.pushState({}, 'Lupt Chat', url);
|
||||||
|
|
||||||
socket.send(JSON.stringify({cmd: 'list'}));
|
socket.send(JSON.stringify({cmd: 'list'}));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue