mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-03 19:57:29 +01:00
Add email/password sign up
This commit is contained in:
parent
63a3b5e872
commit
df291db69b
@ -121,12 +121,15 @@ class User(db.Model, UserMixin):
|
|||||||
packages = db.relationship("Package", backref="author", lazy="dynamic")
|
packages = db.relationship("Package", backref="author", lazy="dynamic")
|
||||||
requests = db.relationship("EditRequest", backref="author", lazy="dynamic")
|
requests = db.relationship("EditRequest", backref="author", lazy="dynamic")
|
||||||
|
|
||||||
def __init__(self, username):
|
def __init__(self, username, active=False, email=None, password=None):
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
self.username = username
|
self.username = username
|
||||||
self.confirmed_at = datetime.datetime.now() - datetime.timedelta(days=6000)
|
self.confirmed_at = datetime.datetime.now() - datetime.timedelta(days=6000)
|
||||||
self.display_name = username
|
self.display_name = username
|
||||||
|
self.active = active
|
||||||
|
self.email = email
|
||||||
|
self.password = password
|
||||||
self.rank = UserRank.NOT_JOINED
|
self.rank = UserRank.NOT_JOINED
|
||||||
|
|
||||||
def canAccessTodoList(self):
|
def canAccessTodoList(self):
|
||||||
|
@ -95,5 +95,21 @@ Creating an Account
|
|||||||
<input type="submit" value="Next">
|
<input type="submit" value="Next">
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="box box_grey">
|
||||||
|
<h2>Option 3 - Email/password sign up</h2>
|
||||||
|
|
||||||
|
<div class="box-body">
|
||||||
|
<p>
|
||||||
|
<b>Only do this if you don't have a forum account!</b>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
If you have a forum account, please use one of the other two
|
||||||
|
options.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<a class="button" href="{{ url_for('user.register') }}">Register</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
Minetest Forum
|
Minetest Forum
|
||||||
</a>
|
</a>
|
||||||
{% elif user == current_user %}
|
{% elif user == current_user %}
|
||||||
<a href="">Link Forums Account</a>
|
No forum account
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if (user.forums_username and user.github_username) or user == current_user %}
|
{% if (user.forums_username and user.github_username) or user == current_user %}
|
||||||
|
@ -62,7 +62,11 @@ def flatpage(path):
|
|||||||
|
|
||||||
@app.before_request
|
@app.before_request
|
||||||
def do_something_whenever_a_request_comes_in():
|
def do_something_whenever_a_request_comes_in():
|
||||||
if current_user.is_authenticated and current_user.rank == UserRank.BANNED:
|
if current_user.is_authenticated:
|
||||||
|
if current_user.rank == UserRank.BANNED:
|
||||||
flash("You have been banned.", "error")
|
flash("You have been banned.", "error")
|
||||||
logout_user()
|
logout_user()
|
||||||
return redirect(url_for('user.login'))
|
return redirect(url_for('user.login'))
|
||||||
|
elif current_user.rank == UserRank.NOT_JOINED:
|
||||||
|
current_user.rank = UserRank.MEMBER
|
||||||
|
db.session.commit()
|
||||||
|
Loading…
Reference in New Issue
Block a user