commit 6c8fe07a12dd47d641feae6be91e6a2b9250d418
parent 2fa7153559b7fda277a80a5f64d5ccd74de8ca56
Author: hhvn <hayden@haydenvh.com>
Date: Mon, 1 Feb 2021 10:00:29 +0000
bin/login.sh config.sh: add option to enable/disable verification
Diffstat:
2 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/bin/login.sh b/bin/login.sh
@@ -31,29 +31,31 @@ login(){
anykey
return 1
}
- prompt "email (verification only)" email
+ prompt "email" email
echo "$email" | grep '[a-zA-Z0-9+.]*@[A-Za-z0-9.]*.[A-Za-z0-9.]*' >/dev/null || {
error "doesn't look like an email"
anykey
return 1
}
- vercode=$(head -n 5 /dev/urandom | base64 | tr -d '\n' | cut -c-10)
- (
- echo "This is the bbs auto-mailer"
- echo
- echo "Your verification code is:"
- echo "$vercode"
- echo
- echo "If this message is not intended for you, please ignore it"
- ) | mail -s "$bbs_addr verification code" -r "$email_addr" -- "$email"
+ [ "$verify_email" = "yes" ] && {
+ vercode=$(head -n 5 /dev/urandom | base64 | tr -d '\n' | cut -c-10)
+ (
+ echo "This is the bbs auto-mailer"
+ echo
+ echo "Your verification code is:"
+ echo "$vercode"
+ echo
+ echo "If this message is not intended for you, please ignore it"
+ ) | mail -s "$bbs_addr verification code" -r "$email_addr" -- "$email"
+ userset "$user" "expiry" "$(dateadd $(date +%Y-%m-%d) +2d)"
+ userset "$user" "vercode" "$vercode"
+ }
userset "$user" "creation" "$(date +%Y-%m-%d)"
- userset "$user" "expiry" "$(dateadd $(date +%Y-%m-%d) +2d)"
userset "$user" "email" "$email"
userset "$user" "passwd" "$(echo "$passwd" | sha512sum)"
- userset "$user" "vercode" "$vercode"
touch $datadir/profile/$user
ok "account \"$user\" created"
- info "Your account expires in 2 days unless verified"
+ [ "$verify_email" = "yes" ] && info "Your account expires in 2 days unless verified"
echo "Login to your account"
echo
anykey
diff --git a/config.sh b/config.sh
@@ -27,6 +27,7 @@ ok____colour=34
num___colour=23
key___colour=12
date__colour=9
+verify_email=no
# If you used the makefile, you should
# be able to include /etc/xinet.d/hbbs